# 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
try:
med_file_mesh = MEDFileMesh.New(file_path)
groups = list(med_file_mesh.getGroupsOnSpecifiedLev(-1))
- except:
+ except Exception as e:
+ print e.what()
return []
return groups
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()
-
- if is_ok:
- editor.setText(str(value))
+ value = index.model().data(index, Qt.EditRole)
+ if value.isdigit():
+ editor.setText(value)
else:
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, filt = 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, filt = 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):
row_nb, is_ok = combo.property(ROW_PROPERTY_NAME).toInt()
if is_ok and row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
+ #row_nb = combo.property(ROW_PROPERTY_NAME)
+
+ #if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
lihbor = values[0]
liubor = values[1]
livbor = values[2]
"""Define result file path"""
def on_result_file_browse(self):
- file_path = QtGui.QFileDialog.getSaveFileName(self, self.tr("Select output file path"))
+ file_path, filt = QFileDialog.getSaveFileName(self, self.tr("Select output file path"))
+ #print 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."))
- 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("Boundary conditions list is empty."))
+ elif len(self.get_output_path())==0:
+ 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);
- pass
\ No newline at end of file
+ QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg);
+ pass
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
CREATE_COUPLING1D2D_CASE_ID = 948
EDIT_COUPLING1D2D_CASE_ID = 949
OPEN_SCHEMA_IN_YACS_ID = 950
- CREATE_PYTEL_CASE_ID = 951
- RUN_PYTEL_ID = 952
- EDIT_PYTEL_CASE_ID = 953
+ #CREATE_PYTEL_CASE_ID = 951
+ #RUN_PYTEL_ID = 952
+ #EDIT_PYTEL_CASE_ID = 953
GENERATE_JOB = 954
DEFINE_BOUNDARY_CONDITIONS_ID = 955
EDIT_BOUNDARY_CONDITIONS_FILE_ID = 956
sgPyQt.createMenu( a, mid )
sgPyQt.createTool( a, tid )
- a = sgPyQt.createAction( GUIcontext.CREATE_PYTEL_CASE_ID,
- "Create case for Pytel execution", "Create case for Pytel execution",
- "Create a new case for Pytel execution", "create_case_pytel.png" )
+ #a = sgPyQt.createAction( GUIcontext.CREATE_PYTEL_CASE_ID,
+ # "Create case for Pytel execution", "Create case for Pytel execution",
+ # "Create a new case for Pytel execution", "create_case_pytel.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ #sgPyQt.createMenu( a, mid )
+ #sgPyQt.createTool( a, tid )
a = sgPyQt.createSeparator()
sgPyQt.createMenu( a, mid )
sgPyQt.createAction( GUIcontext.OPEN_SCHEMA_IN_YACS_ID, "Open schema in YACS", "Open schema in YACS",
"Open the selected 1D / 2D coupling schema in YACS" )
- sgPyQt.createAction( GUIcontext.RUN_PYTEL_ID, "Compute case", "Compute case",
- "Run Pytel launcher to compute the case" )
- sgPyQt.createAction( GUIcontext.EDIT_PYTEL_CASE_ID, "Edit case", "Edit case",
- "Edit the selected Pytel case" )
+ #sgPyQt.createAction( GUIcontext.RUN_PYTEL_ID, "Compute case", "Compute case",
+ # "Run Pytel launcher to compute the case" )
+ #sgPyQt.createAction( GUIcontext.EDIT_PYTEL_CASE_ID, "Edit case", "Edit case",
+ # "Edit the selected Pytel case" )
sgPyQt.createAction( GUIcontext.GENERATE_JOB, "Generate batch job", "Generate batch job",
"Generate a batch job to run the selected case")
popup.addAction(sgPyQt.action(GUIcontext.OPEN_SCHEMA_IN_YACS_ID))
elif selectedType == hydro_study.LOG_TYPE_ID:
popup.addAction(sgPyQt.action(GUIcontext.SHOW_LOG_ID))
- elif selectedType == hydro_study.PYTEL_CASE_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.EDIT_PYTEL_CASE_ID))
- popup.addAction(sgPyQt.action(GUIcontext.RUN_PYTEL_ID))
- popup.addAction(sgPyQt.action(GUIcontext.GENERATE_JOB))
+ #elif selectedType == hydro_study.PYTEL_CASE_TYPE_ID:
+ # popup.addAction(sgPyQt.action(GUIcontext.EDIT_PYTEL_CASE_ID))
+ # popup.addAction(sgPyQt.action(GUIcontext.RUN_PYTEL_ID))
+ # popup.addAction(sgPyQt.action(GUIcontext.GENERATE_JOB))
# called when GUI action is activated
# action ID is passed as parameter
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)
GUIcontext.CREATE_COUPLING1D2D_CASE_ID: create_coupling1d2d_case,
GUIcontext.EDIT_COUPLING1D2D_CASE_ID: edit_coupling1d2d_case,
GUIcontext.OPEN_SCHEMA_IN_YACS_ID: open_schema_in_yacs,
- GUIcontext.CREATE_PYTEL_CASE_ID: pytel_gui.create_case,
- GUIcontext.RUN_PYTEL_ID: pytel_gui.run_selected_case,
- GUIcontext.EDIT_PYTEL_CASE_ID: pytel_gui.edit_selected_case,
- GUIcontext.GENERATE_JOB: pytel_gui.generate_job_for_selected_case,
+ #GUIcontext.CREATE_PYTEL_CASE_ID: pytel_gui.create_case,
+ #GUIcontext.RUN_PYTEL_ID: pytel_gui.run_selected_case,
+ #GUIcontext.EDIT_PYTEL_CASE_ID: pytel_gui.edit_selected_case,
+ #GUIcontext.GENERATE_JOB: pytel_gui.generate_job_for_selected_case,
GUIcontext.DEFINE_BOUNDARY_CONDITIONS_ID: define_boundary_conditions,
GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
GUIcontext.GENERATE_INTERPOLZ_PY_ID: generate_interpolz_py,
ADD_SUBDIRECTORY(mascaret)
ADD_SUBDIRECTORY(telemac2d)
-ADD_SUBDIRECTORY(pytel)
+#ADD_SUBDIRECTORY(pytel)
ADD_SUBDIRECTORY(coupling1d2d)
ADD_SUBDIRECTORY(boundary_conditions)
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
from generate_interpolz import generate
def get_med_groups( file_path ):
- #print "get_med_groups", file_path
+ print "get_med_groups", file_path
try:
- meshes = MEDLoader.MEDLoader_GetMeshNames(file_path)
+ meshes = MEDLoader.GetMeshNames(file_path)
except:
+ print 'No meshes found'
return []
if len(meshes)==0:
+ print 'No mesh found'
return []
mesh1 = meshes[0]
+ print 'Found mesh:', mesh1
try:
groups = list(MEDLoader.MEDLoader_GetMeshGroupsNames(file_path, mesh1))
-
+ print 'Found groups:', groups
except:
+ print 'No groups found'
return []
return groups
doc = HYDROPy.HYDROData_Document.Document( aStudyId )
for i in ind:
if i.column()==0:
- name = i.data().toString()
+ name = str(i.data())
case = doc.FindObjectByName( name )
if isinstance(case, HYDROPy.HYDROData_CalculationCase):
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 )
+ SalomePyQt.SalomePyQt.getObjectBrowser().selectionChanged.connect(self.onSelectionChanged)
+ self.btnOutputPath.clicked.connect(self.onOutputFile)
+ self.btnMEDFile.clicked.connect(self.onMEDFile)
+ self.CalcCase.textChanged.connect(self.onCalcCaseChanged)
+ self.MEDFile.textChanged.connect(self.onMEDChanged)
self.UndefZ.setRange( -100000, 100000 )
self.UndefZ.setValue( -9999 )
self.InterpMethod.addItem( "Interpolation at the nearest point" )
- self.InterpMethod.addItem( "Linear interpolation on a cloud triangulation" )
- 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.ApplyClose.clicked.connect(self.onApplyClose)
+ self.Apply.clicked.connect(self.onApply)
+ self.Close.clicked.connect(self.onClose)
+ self.Help.clicked.connect(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 )
- if f!=None and f!="":
- self.OutputPath.setText( f )
+ fname, filt = QFileDialog.getSaveFileName( self, caption, ".", mask )
+ if fname!=None and fname!="":
+ self.OutputPath.setText( fname )
def onMEDFile( self ):
caption = "MED file"
mask = "*.med"
- f = QtGui.QFileDialog.getOpenFileName( self, caption, ".", mask )
- if f!=None and f!="":
- self.MEDFile.setText( f )
+ fname, filt = QFileDialog.getOpenFileName( self, caption, ".", mask )
+ if fname!=None and fname!="":
+ self.MEDFile.setText( fname )
def onCalcCaseChanged( self ):
self.regions = get_hydro_regions( str(self.CalcCase.text()) )
def onMEDChanged( self ):
self.med_groups = get_med_groups( str(self.MEDFile.text()) )
- #print self.med_groups
+ print self.med_groups
n = len( self.med_groups )
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 )
cb.addItem( 'None' )
for r in self.regions:
cb.addItem( r )
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()