# 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")
##
## From GUI:
##
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
+FIND_PACKAGE(SalomePyQt5 REQUIRED)
##
## HYDROSOLVER specifics
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
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)
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))
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
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)
"""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
# 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)
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):
"""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)
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())
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()
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):
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()):
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
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
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
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
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 "
'<a href="https://forge-pleiade.der.edf.fr/projects/salome-rex/issues">SALOME bugtracker</a>, '
'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())
"""
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)
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)
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)
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)
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)
import sys
import re
-from PyQt4.QtGui import QMessageBox
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
import salome
import SalomePyQt
# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
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
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():
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
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
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()
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 )
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 )
msg = "InterpolZ script is successfully generated"
result = True
- QtGui.QMessageBox.information( self, "", msg )
+ QMessageBox.information( self, "", msg )
return result
def onClose( self ):
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__':
import sys
import re
-from PyQt4.QtGui import QMessageBox
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
import salome
import SalomePyQt
ADD_SUBDIRECTORY(eficas)
-INCLUDE(UsePyQt4)
+INCLUDE(UsePyQt5)
# --- Python files ---
import os
import sys
-from PyQt4.QtGui import QMessageBox
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
import salome
import SalomePyQt
# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
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
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"])
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)
import sys
import re
-from PyQt4.QtGui import QMessageBox
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
import salome
import SalomePyQt
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")
from BndConditionsDialog import BoundaryConditionsDialog
# Show the dialog
-app = QtGui.QApplication(sys.argv)
+app = QApplication(sys.argv)
window = BoundaryConditionsDialog()
window.show()