From 536c55524f9f0e36a20ee5b429fda177586336e1 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 23 Jan 2017 15:09:14 +0300 Subject: [PATCH] porting to PyQt5 --- CMakeLists.txt | 12 +++- src/HYDROGUI/BndConditionsDialog.py | 59 ++++++++++--------- src/HYDROGUI/HYDROSOLVERGUI.py | 38 ++++++------ src/salome_hydro/coupling1d2d/eficas/appli.py | 3 +- src/salome_hydro/gui_utils.py | 12 ++-- src/salome_hydro/interpolz_gui.py | 41 +++++++------ src/salome_hydro/mascaret/eficas/appli.py | 4 +- src/salome_hydro/pytel/CMakeLists.txt | 2 +- src/salome_hydro/pytel/eficas/appli.py | 4 +- src/salome_hydro/pytel/genjobwindow.py | 20 ++++--- src/salome_hydro/telemac2d/eficas/appli.py | 4 +- tests/boundaryConditionsDlgTest.py | 5 +- 12 files changed, 116 insertions(+), 88 deletions(-) mode change 100644 => 100755 src/HYDROGUI/HYDROSOLVERGUI.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 23fbc6e..0936733 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,10 +34,18 @@ SET(${PROJECT_NAME_UC}_VERSION_DEV 1) # Find KERNEL # =========== +SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") +IF(EXISTS ${CONFIGURATION_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") + INCLUDE(SalomeMacros) +ELSE() + MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") +ENDIF() + SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") IF(EXISTS ${KERNEL_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") - INCLUDE(SalomeMacros) + #INCLUDE(SalomeMacros) FIND_PACKAGE(SalomeKERNEL REQUIRED) ELSE(EXISTS ${KERNEL_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") @@ -94,7 +102,7 @@ ENDIF(EXISTS ${GUI_ROOT_DIR}) ## ## From GUI: ## -FIND_PACKAGE(SalomePyQt4 REQUIRED) +FIND_PACKAGE(SalomePyQt5 REQUIRED) ## ## HYDROSOLVER specifics diff --git a/src/HYDROGUI/BndConditionsDialog.py b/src/HYDROGUI/BndConditionsDialog.py index 5156d84..21f109b 100644 --- a/src/HYDROGUI/BndConditionsDialog.py +++ b/src/HYDROGUI/BndConditionsDialog.py @@ -18,7 +18,10 @@ import os import sys -from PyQt4 import QtCore, QtGui, uic +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * +from PyQt5 import uic from MEDLoader import MEDFileMesh @@ -70,15 +73,15 @@ def get_int(str): return value """Item delegate for LIHBOR, LIUBOR, LIVBOR and LITBOR columns""" -class ValueDelegate(QtGui.QStyledItemDelegate): +class ValueDelegate(QStyledItemDelegate): def __init__(self, parent = None): - QtGui.QStyledItemDelegate.__init__(self, parent) + QStyledItemDelegate.__init__(self, parent) def createEditor(self, parent, option, index): - line_edit = QtGui.QLineEdit(parent) + line_edit = QLineEdit(parent) - validator = QtGui.QIntValidator(parent) + validator = QIntValidator(parent) validator.setRange(0, 6) line_edit.setValidator(validator) @@ -86,7 +89,7 @@ class ValueDelegate(QtGui.QStyledItemDelegate): return line_edit def setEditorData(self, editor, index): - value, is_ok = index.model().data(index, QtCore.Qt.EditRole).toInt() + value, is_ok = index.model().data(index, Qt.EditRole).toInt() if is_ok: editor.setText(str(value)) @@ -94,16 +97,16 @@ class ValueDelegate(QtGui.QStyledItemDelegate): editor.setText('') def setModelData(self, editor, model, index): - model.setData(index, editor.text(), QtCore.Qt.EditRole) + model.setData(index, editor.text(), Qt.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) """Boundary conditions definition dialog""" -class BoundaryConditionsDialog(QtGui.QDialog): +class BoundaryConditionsDialog(QDialog): def __init__(self, parent = None, modal = 0): - QtGui.QDialog.__init__(self, parent) + QDialog.__init__(self, parent) uic.loadUi(os.path.join(hydro_solver_root, 'BndConditionsDialog.ui'), self ) # Connections @@ -174,7 +177,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): preset_name = get_preset_name(self.presets, lihbor, liubor, livbor, litbor) combo = self.boundaryConditionsTable.cellWidget(row, 0) - if isinstance(combo, QtGui.QComboBox): + if isinstance(combo, QComboBox): ind = combo.findText(preset_name) if ind >= 0: combo.setCurrentIndex(ind) @@ -209,7 +212,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): """Select MED file""" def on_med_file_browse(self): # Get file path - file_path = QtGui.QFileDialog.getOpenFileName(self, self.tr("Open MED file"), "", self.tr("MED files (*.med)")) + file_path = QFileDialog.getOpenFileName(self, self.tr("Open MED file"), "", self.tr("MED files (*.med)")) if not file_path: return @@ -223,11 +226,11 @@ class BoundaryConditionsDialog(QtGui.QDialog): # Update table self.set_groups(groups) else: - QtGui.QMessageBox.warning(self, self.tr("Warning"), self.tr("Can't get group names from the selected MED file.")) + QMessageBox.warning(self, self.tr("Warning"), self.tr("Can't get group names from the selected MED file.")) """Select boundary conditions file""" def on_bnd_file_browse(self): - file_path = QtGui.QFileDialog.getOpenFileName(self, self.tr("Open boundary conditions file")) + file_path = QFileDialog.getOpenFileName(self, self.tr("Open boundary conditions file")) if file_path: self.bndConditionsFileEdit.setText(file_path) @@ -242,12 +245,12 @@ class BoundaryConditionsDialog(QtGui.QDialog): read_errors = reader.errors if len( read_errors ) > 0: msg = "\n".join(read_errors) - QtGui.QMessageBox.warning(self, self.tr("Warning"), msg) + QMessageBox.warning(self, self.tr("Warning"), msg) if len(self.input_conditions) > 0: self.update_table() else: - QtGui.QMessageBox.warning(self, self.tr("Warning"), self.tr("No conditions have been read from the file.")) + QMessageBox.warning(self, self.tr("Warning"), self.tr("No conditions have been read from the file.")) """Called on preset selection in the first column of the table""" def on_preset_changed(self): @@ -279,7 +282,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): """Define result file path""" def on_result_file_browse(self): - file_path = QtGui.QFileDialog.getSaveFileName(self, self.tr("Select output file path")) + file_path = QFileDialog.getSaveFileName(self, self.tr("Select output file path")) if file_path: self.resultBndConditionsFileEdit.setText(file_path) @@ -292,7 +295,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): self.boundaryConditionsTable.insertRow(row_nb) # 'Preset' column - combo = QtGui.QComboBox(self) + combo = QComboBox(self) combo.addItem('') if len(self.presets) > 0: combo.addItems(self.presets.keys()) @@ -304,23 +307,23 @@ class BoundaryConditionsDialog(QtGui.QDialog): self.boundaryConditionsTable.setCellWidget(row_nb, 0, combo) # 'LIHBOR' column - self.boundaryConditionsTable.setItem(row_nb, 1, QtGui.QTableWidgetItem('')) + self.boundaryConditionsTable.setItem(row_nb, 1, QTableWidgetItem('')) # 'LIUBOR' column - self.boundaryConditionsTable.setItem(row_nb, 2, QtGui.QTableWidgetItem('')) + self.boundaryConditionsTable.setItem(row_nb, 2, QTableWidgetItem('')) # 'LIVBOR' column - self.boundaryConditionsTable.setItem(row_nb, 3, QtGui.QTableWidgetItem('')) + self.boundaryConditionsTable.setItem(row_nb, 3, QTableWidgetItem('')) # 'LITBOR' column - self.boundaryConditionsTable.setItem(row_nb, 4, QtGui.QTableWidgetItem('')) + self.boundaryConditionsTable.setItem(row_nb, 4, QTableWidgetItem('')) # 'Group' column - item = QtGui.QTableWidgetItem(group) + item = QTableWidgetItem(group) font = item.font() font.setBold(True) item.setFont(font) - item.setFlags(QtCore.Qt.ItemIsEnabled) + item.setFlags(Qt.ItemIsEnabled) self.boundaryConditionsTable.setItem(row_nb, 5, item) self.update_table() @@ -348,7 +351,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): is_updated = True if not is_updated and nb_rows > 0 and len(self.input_conditions) > 0: - QtGui.QMessageBox.information(self, self.tr("Information"), self.tr("No one group name from the MED file is presented in the input list of conditions.")) + QMessageBox.information(self, self.tr("Information"), self.tr("No one group name from the MED file is presented in the input list of conditions.")) """Get output file path""" def get_output_path(self): @@ -364,9 +367,9 @@ class BoundaryConditionsDialog(QtGui.QDialog): is_ok = False if self.boundaryConditionsTable.rowCount() < 1: - QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Boundary conditions list is empty.")) + QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Boundary conditions list is empty.")) elif self.get_output_path().isEmpty(): - QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty.")) + QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty.")) else: has_empty_cells = False for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()): @@ -380,7 +383,7 @@ class BoundaryConditionsDialog(QtGui.QDialog): break if has_empty_cells: - QtGui.QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s).")) + QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Table has empty cell(s).")) else: is_ok = True @@ -419,5 +422,5 @@ class BoundaryConditionsDialog(QtGui.QDialog): to perform the data export to the file. Click on "Close" button does not lead to saving the data and just closes the dialog. """ - QtGui.QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg); + QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg); pass \ No newline at end of file diff --git a/src/HYDROGUI/HYDROSOLVERGUI.py b/src/HYDROGUI/HYDROSOLVERGUI.py old mode 100644 new mode 100755 index 133e55c..bb74eb6 --- a/src/HYDROGUI/HYDROSOLVERGUI.py +++ b/src/HYDROGUI/HYDROSOLVERGUI.py @@ -20,7 +20,9 @@ import os import traceback import logging -from PyQt4 import QtCore, QtGui +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * import salome import SALOME @@ -36,11 +38,11 @@ import HYDROSOLVER_ORB from salome.hydro.interpolz_gui import InterpolzDlg from salome.hydro.gui_utils import HSGUIException, wait_cursor, get_and_check_selected_file_path import salome.hydro.study as hydro_study -from salome.hydro.mascaret.eficas.appli import EficasForMascaretAppli -from salome.hydro.telemac2d.eficas.appli import EficasForTelemac2DAppli -from salome.hydro.coupling1d2d.eficas.appli import EficasForCoupling1D2DAppli -import salome.hydro.pytel.gui as pytel_gui -from salome.hydro.boundary_conditions.eficas.appli import EficasForBoundaryConditionsAppli +#from salome.hydro.mascaret.eficas.appli import EficasForMascaretAppli +#from salome.hydro.telemac2d.eficas.appli import EficasForTelemac2DAppli +#from salome.hydro.coupling1d2d.eficas.appli import EficasForCoupling1D2DAppli +#import salome.hydro.pytel.gui as pytel_gui +#from salome.hydro.boundary_conditions.eficas.appli import EficasForBoundaryConditionsAppli import BndConditionsDialog @@ -282,17 +284,17 @@ def OnGUIEvent( commandID ): try: dict_command[commandID]() except HSGUIException, exc: - QtGui.QMessageBox.critical(sgPyQt.getDesktop(), - QtGui.QApplication.translate("OnGUIEvent", "Error"), + QMessageBox.critical(sgPyQt.getDesktop(), + QApplication.translate("OnGUIEvent", "Error"), unicode(exc)) except: logger.exception("Unhandled exception caught in HYDROSOLVER GUI") - msg = QtGui.QApplication.translate("OnGUIEvent", + msg = QApplication.translate("OnGUIEvent", "Unhandled error happened in HYDROSOLVER module. Please report a bug on " 'SALOME bugtracker, ' 'category "HYDROSOLVER", describing how you got there and including the following traceback:') - msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Critical, - QtGui.QApplication.translate("OnGUIEvent", "Error"), + msgBox = QMessageBox(QMessageBox.Critical, + QApplication.translate("OnGUIEvent", "Error"), msg, parent = sgPyQt.getDesktop()) msgBox.setDetailedText(traceback.format_exc()) @@ -308,13 +310,13 @@ def OnGUIEvent( commandID ): """ from TextDisplayDialog import Ui_TextDisplayDialog -class MyTextDisplayDialog(Ui_TextDisplayDialog, QtGui.QDialog): +class MyTextDisplayDialog(Ui_TextDisplayDialog, QDialog): def __init__(self, parent = None, modal = 0): - QtGui.QDialog.__init__(self, parent) + QDialog.__init__(self, parent) Ui_TextDisplayDialog.__init__(self) self.setupUi(self) - self.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.close) + self.connect(self.closeButton, SIGNAL("clicked()"), self.close) def set_log(self, log): self.contentTextEdit.setPlainText(log) @@ -350,7 +352,7 @@ def run_mascaret(): salome.sg.updateObjBrowser( 0 ) except SALOME.SALOME_Exception, exc: salome.sg.updateObjBrowser( 0 ) - msg = unicode(QtGui.QApplication.translate("run_mascaret", + msg = unicode(QApplication.translate("run_mascaret", "An error happened while trying to run Mascaret:")) msg += "\n" + exc.details.text raise HSGUIException(msg) @@ -393,7 +395,7 @@ def run_telemac2d(): except SALOME.SALOME_Exception, exc: if engine is not None: engine.GetContainerRef().Shutdown() - msg = unicode(QtGui.QApplication.translate("run_telemac2d", + msg = unicode(QApplication.translate("run_telemac2d", "An error happened while trying to run Telemac2D:")) msg += "\n" + exc.details.text raise HSGUIException(msg) @@ -403,7 +405,7 @@ def run_telemac2d(): engine.GetContainerRef().Shutdown() except: pass - msg = unicode(QtGui.QApplication.translate("run_telemac2d", + msg = unicode(QApplication.translate("run_telemac2d", "An error happened in the computation (Telemac2D probably crashed, " "see logs and listing files for more details):")) msg += "\n" + unicode(exc) @@ -428,7 +430,7 @@ def open_schema_in_yacs(): if filename.endswith(".comm"): filename = filename[:-5] + ".xml" if not os.path.isfile(filename): - raise HSGUIException(QtGui.QApplication.translate("open_schema_in_yacs", + raise HSGUIException(QApplication.translate("open_schema_in_yacs", "Schema file %1 does not exist").arg(filename)) yg = salome.ImportComponentGUI("YACS") yg.loadSchema(filename) diff --git a/src/salome_hydro/coupling1d2d/eficas/appli.py b/src/salome_hydro/coupling1d2d/eficas/appli.py index 30843c4..9d379dd 100644 --- a/src/salome_hydro/coupling1d2d/eficas/appli.py +++ b/src/salome_hydro/coupling1d2d/eficas/appli.py @@ -21,7 +21,8 @@ import os import sys import re -from PyQt4.QtGui import QMessageBox +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * import salome import SalomePyQt diff --git a/src/salome_hydro/gui_utils.py b/src/salome_hydro/gui_utils.py index 0463e04..cc080aa 100644 --- a/src/salome_hydro/gui_utils.py +++ b/src/salome_hydro/gui_utils.py @@ -16,7 +16,9 @@ # along with SALOME HYDRO module. If not, see . import os -from PyQt4 import QtCore, QtGui +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * import salome from salome.kernel.studyedit import getStudyEditor @@ -39,12 +41,12 @@ class OverrideCursorCM: self.cursor = cursor def __enter__(self): - QtGui.QApplication.setOverrideCursor(self.cursor) + QApplication.setOverrideCursor(self.cursor) def __exit__(self, exc_type, exc_value, traceback): - QtGui.QApplication.restoreOverrideCursor() + QApplication.restoreOverrideCursor() -wait_cursor = OverrideCursorCM(QtGui.QCursor(QtCore.Qt.WaitCursor)) +wait_cursor = OverrideCursorCM(QCursor(Qt.WaitCursor)) def get_and_check_selected_file_path(): @@ -56,6 +58,6 @@ def get_and_check_selected_file_path(): sobj = ed.study.FindObjectID(salome.sg.getSelected(0)) filepath = sobj.GetComment() if not os.path.isfile(filepath): - raise HSGUIException(QtGui.QApplication.translate("get_and_check_selected_file_path", + raise HSGUIException(QApplication.translate("get_and_check_selected_file_path", "File %1 does not exist").arg(filepath)) return filepath diff --git a/src/salome_hydro/interpolz_gui.py b/src/salome_hydro/interpolz_gui.py index c15d84d..8672012 100644 --- a/src/salome_hydro/interpolz_gui.py +++ b/src/salome_hydro/interpolz_gui.py @@ -10,7 +10,10 @@ salome.salome_init() import MEDLoader import HYDROPy -from PyQt4 import QtCore, QtGui, uic +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * +from PyQt5 import uic import SalomePyQt import libSALOME_Swig @@ -65,24 +68,24 @@ def get_selected_calc_case(): return name return None -class InterpolzDlg( QtGui.QDialog ): +class InterpolzDlg( QDialog ): def __init__(self, parent = None): - QtGui.QDialog.__init__( self, parent ) + QDialog.__init__( self, parent ) p = hydro_solver_root uic.loadUi( p+'/interpolz.ui', self ) self.setWindowTitle( 'Generate interpolz script' ) - self.connect( SalomePyQt.SalomePyQt.getObjectBrowser(), QtCore.SIGNAL("selectionChanged()"), self.onSelectionChanged ) - self.connect( self.btnOutputPath, QtCore.SIGNAL( "clicked()" ), self.onOutputFile ) - self.connect( self.btnMEDFile, QtCore.SIGNAL( "clicked()" ), self.onMEDFile ) - self.connect( self.CalcCase, QtCore.SIGNAL( "textChanged( const QString& )" ), self.onCalcCaseChanged ) - self.connect( self.MEDFile, QtCore.SIGNAL( "textChanged( const QString& )" ), self.onMEDChanged ) + self.connect( SalomePyQt.SalomePyQt.getObjectBrowser(), SIGNAL("selectionChanged()"), self.onSelectionChanged ) + self.connect( self.btnOutputPath, SIGNAL( "clicked()" ), self.onOutputFile ) + self.connect( self.btnMEDFile, SIGNAL( "clicked()" ), self.onMEDFile ) + self.connect( self.CalcCase, SIGNAL( "textChanged( const QString& )" ), self.onCalcCaseChanged ) + self.connect( self.MEDFile, SIGNAL( "textChanged( const QString& )" ), self.onMEDChanged ) self.UndefZ.setRange( -100000, 100000 ) self.UndefZ.setValue( -9999 ) self.InterpMethod.addItem( "Interpolation at the nearest point" ) - self.connect( self.ApplyClose, QtCore.SIGNAL( "clicked()" ), self.onApplyClose ) - self.connect( self.Apply, QtCore.SIGNAL( "clicked()" ), self.onApply ) - self.connect( self.Close, QtCore.SIGNAL( "clicked()" ), self.onClose ) - self.connect( self.Help, QtCore.SIGNAL( "clicked()" ), self.onHelp ) + self.connect( self.ApplyClose, SIGNAL( "clicked()" ), self.onApplyClose ) + self.connect( self.Apply, SIGNAL( "clicked()" ), self.onApply ) + self.connect( self.Close, SIGNAL( "clicked()" ), self.onClose ) + self.connect( self.Help, SIGNAL( "clicked()" ), self.onHelp ) def onSelectionChanged( self ): calc_case_name = get_selected_calc_case() @@ -92,14 +95,14 @@ class InterpolzDlg( QtGui.QDialog ): def onOutputFile( self ): caption = "Python file" mask = "*.py" - f = QtGui.QFileDialog.getSaveFileName( self, caption, ".", mask ) + f = QFileDialog.getSaveFileName( self, caption, ".", mask ) if f!=None and f!="": self.OutputPath.setText( f ) def onMEDFile( self ): caption = "MED file" mask = "*.med" - f = QtGui.QFileDialog.getOpenFileName( self, caption, ".", mask ) + f = QFileDialog.getOpenFileName( self, caption, ".", mask ) if f!=None and f!="": self.MEDFile.setText( f ) @@ -114,11 +117,11 @@ class InterpolzDlg( QtGui.QDialog ): self.Groups.setRowCount( n ) for i in range( 0, n ): if self.Groups.item( i, 0 ) is None: - self.Groups.setItem( i, 0, QtGui.QTableWidgetItem() ) - self.Groups.setItem( i, 1, QtGui.QTableWidgetItem() ) + self.Groups.setItem( i, 0, QTableWidgetItem() ) + self.Groups.setItem( i, 1, QTableWidgetItem() ) self.Groups.item( i, 0 ).setText( self.med_groups[i] ) - cb = QtGui.QComboBox( self.Groups ) + cb = QComboBox( self.Groups ) for r in self.regions: cb.addItem( r ) self.Groups.setCellWidget( i, 1, cb ) @@ -158,7 +161,7 @@ class InterpolzDlg( QtGui.QDialog ): msg = "InterpolZ script is successfully generated" result = True - QtGui.QMessageBox.information( self, "", msg ) + QMessageBox.information( self, "", msg ) return result def onClose( self ): @@ -191,7 +194,7 @@ class InterpolzDlg( QtGui.QDialog ): When the data is input, the user clicks on "Apply" or "Apply and Close" button to perform the script generation. """ - QtGui.QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg); + QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg); if __name__=='__main__': diff --git a/src/salome_hydro/mascaret/eficas/appli.py b/src/salome_hydro/mascaret/eficas/appli.py index 126a184..b5fe084 100644 --- a/src/salome_hydro/mascaret/eficas/appli.py +++ b/src/salome_hydro/mascaret/eficas/appli.py @@ -21,7 +21,9 @@ import os import sys import re -from PyQt4.QtGui import QMessageBox +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * + import salome import SalomePyQt diff --git a/src/salome_hydro/pytel/CMakeLists.txt b/src/salome_hydro/pytel/CMakeLists.txt index ca9b36c..0620de6 100644 --- a/src/salome_hydro/pytel/CMakeLists.txt +++ b/src/salome_hydro/pytel/CMakeLists.txt @@ -17,7 +17,7 @@ ADD_SUBDIRECTORY(eficas) -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt5) # --- Python files --- diff --git a/src/salome_hydro/pytel/eficas/appli.py b/src/salome_hydro/pytel/eficas/appli.py index 6963549..35f6695 100644 --- a/src/salome_hydro/pytel/eficas/appli.py +++ b/src/salome_hydro/pytel/eficas/appli.py @@ -18,7 +18,9 @@ import os import sys -from PyQt4.QtGui import QMessageBox +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * + import salome import SalomePyQt diff --git a/src/salome_hydro/pytel/genjobwindow.py b/src/salome_hydro/pytel/genjobwindow.py index 5ea6df3..df7df10 100644 --- a/src/salome_hydro/pytel/genjobwindow.py +++ b/src/salome_hydro/pytel/genjobwindow.py @@ -16,7 +16,9 @@ # along with SALOME HYDRO module. If not, see . import os -from PyQt4 import QtGui, QtCore +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * import salome from salome.hydro.pytel.genjob import generate_job @@ -28,10 +30,10 @@ class GenJobDialog(QtGui.QDialog, Ui_GenJobDialog): def __init__(self, parent, pytel_params): QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.connect(self.dialogButtonBox, QtCore.SIGNAL("accepted()"), self.validate) - self.connect(self.dialogButtonBox, QtCore.SIGNAL("rejected()"), self.close) - self.connect(self.chooseInputDataDirectoryButton, QtCore.SIGNAL("clicked()"), self.choose_input_dir) - self.connect(self.chooseResultDirectoryButton, QtCore.SIGNAL("clicked()"), self.choose_result_dir) + self.connect(self.dialogButtonBox, SIGNAL("accepted()"), self.validate) + self.connect(self.dialogButtonBox, SIGNAL("rejected()"), self.close) + self.connect(self.chooseInputDataDirectoryButton, SIGNAL("clicked()"), self.choose_input_dir) + self.connect(self.chooseResultDirectoryButton, SIGNAL("clicked()"), self.choose_result_dir) self.telemacRootDirLE.setText("/home/projets-bgq/systel/V6P2") self.telemacEnvFileLE.setText("/home/projets-bgq/systel/V6P2/config/pysource.zumbrota.xlf14.sh") casedir = os.path.dirname(pytel_params["FICHIER_CAS"]) @@ -47,16 +49,16 @@ class GenJobDialog(QtGui.QDialog, Ui_GenJobDialog): self.pytel_params = pytel_params def choose_input_dir(self): - directory = QtGui.QFileDialog.getExistingDirectory(self, + directory = QFileDialog.getExistingDirectory(self, directory = self.inputDataDirectoryLE.text(), - options = QtGui.QFileDialog.ShowDirsOnly) + options = QFileDialog.ShowDirsOnly) if not directory.isNull(): self.inputDataDirectoryLE.setText(directory) def choose_result_dir(self): - directory = QtGui.QFileDialog.getExistingDirectory(self, + directory = QFileDialog.getExistingDirectory(self, directory = self.resultDirectoryLE.text(), - options = QtGui.QFileDialog.ShowDirsOnly) + options = QFileDialog.ShowDirsOnly) if not directory.isNull(): self.resultDirectoryLE.setText(directory) diff --git a/src/salome_hydro/telemac2d/eficas/appli.py b/src/salome_hydro/telemac2d/eficas/appli.py index 0684bf7..0df10c2 100644 --- a/src/salome_hydro/telemac2d/eficas/appli.py +++ b/src/salome_hydro/telemac2d/eficas/appli.py @@ -21,7 +21,9 @@ import os import sys import re -from PyQt4.QtGui import QMessageBox +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * + import salome import SalomePyQt diff --git a/tests/boundaryConditionsDlgTest.py b/tests/boundaryConditionsDlgTest.py index b38b0c0..05a6dcd 100644 --- a/tests/boundaryConditionsDlgTest.py +++ b/tests/boundaryConditionsDlgTest.py @@ -1,7 +1,8 @@ import os import sys -from PyQt4 import QtGui +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * cur_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(cur_dir, "data") @@ -11,7 +12,7 @@ sys.path.append(hydro_solver_root) from BndConditionsDialog import BoundaryConditionsDialog # Show the dialog -app = QtGui.QApplication(sys.argv) +app = QApplication(sys.argv) window = BoundaryConditionsDialog() window.show() -- 2.39.2