# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
import os
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
-from PyQt5.QtWidgets import *
+#from PyQt4 import QtCore, QtGui
+from PyQt5.QtWidgets import QApplication
+from PyQt5.QtGui import QCursor
+from PyQt5.QtCore import Qt
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(QCursor(QtCore.Qt.WaitCursor))
wait_cursor = OverrideCursorCM(QCursor(Qt.WaitCursor))
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))
+ "File %1 does not exist").arg(filepath))
return filepath
import sys, os
-#sys.path.append(os.path.join(os.environ['MED3HOME'], 'lib/python2.7/site-packages/med'))
+#sys.path.append(os.path.join(os.environ['MEDFILE_ROOT_DIR'], 'lib/python2.7/site-packages/med'))
+sys.path.append(os.path.join(os.environ['MEDFICHIER_INSTALL_DIR'], 'lib/python2.7/site-packages/med'))
hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'salome', 'hydro')
-#sys.path.append(hydro_solver_root)
+sys.path.append(hydro_solver_root)
import salome
salome.salome_init()
import MEDLoader
import HYDROPy
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
-from PyQt5.QtWidgets import *
+from PyQt5.QtWidgets import QDialog, QFileDialog, QTableWidgetItem, QComboBox, QMessageBox
from PyQt5 import uic
import SalomePyQt
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.GetMeshNames(file_path)
except:
mesh1 = meshes[0]
print 'Found mesh:', mesh1
try:
- groups = list(MEDLoader.MEDLoader_GetMeshGroupsNames(file_path, mesh1))
+ groups = list(MEDLoader.GetMeshGroupsNames(file_path, mesh1))
print 'Found groups:', groups
except:
print 'No groups found'
for r in regions:
rname = r.GetName()
regions_names.append( str(rname) )
-
- #shape_groups = case.GetGeometryGroups()
- #for sg in shape_groups:
- #sgname = sg.GetName()
- #regions_names.append( sgname )
-
+
+ shape_groups = case.GetGeometryGroups()
+ for sg in shape_groups:
+ sgname = sg.GetName()
+ regions_names.append( sgname )
+
return regions_names
else:
return []
if isinstance(case, HYDROPy.HYDROData_CalculationCase):
return name
return None
-
+
class InterpolzDlg( QDialog ):
def __init__(self, parent = None):
QDialog.__init__( self, parent )
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()
if calc_case_name is not None:
self.CalcCase.setText( calc_case_name )
-
+
def onOutputFile( self ):
caption = "Python file"
mask = "*.py"
fname, filt = QFileDialog.getSaveFileName( self, caption, ".", mask )
if fname!=None and fname!="":
self.OutputPath.setText( fname )
-
+
def onMEDFile( self ):
caption = "MED file"
mask = "*.med"
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()) )
self.onMEDChanged()
-
+
def onMEDChanged( self ):
self.med_groups = get_med_groups( str(self.MEDFile.text()) )
print self.med_groups
self.Groups.setItem( i, 0, QTableWidgetItem() )
self.Groups.setItem( i, 1, QTableWidgetItem() )
self.Groups.item( i, 0 ).setText( self.med_groups[i] )
-
+
cb = QComboBox( self.Groups )
- cb.addItem( 'None' )
for r in self.regions:
cb.addItem( r )
self.Groups.setCellWidget( i, 1, cb )
def onApplyClose( self ):
if self.onApply():
self.onClose()
-
+
def onApply( self ):
path = str(self.OutputPath.text())
calc_case = str(self.CalcCase.text())
for i in range( 0, self.Groups.rowCount() ):
med_group = str( self.Groups.item( i, 0 ).text() )
hydro_reg = str( self.Groups.cellWidget( i, 1 ).currentText() )
- if len(med_group)>0 and len(hydro_reg)>0 and hydro_reg != 'None':
+ if len(med_group)>0 and len(hydro_reg)>0:
med_groups_regions[med_group] = hydro_reg
z_undef = self.UndefZ.value()
interp = str(self.InterpMethod.currentText())
-
+
msg = ""
if len(path)==0:
msg = "Please input the output path"
msg = "Please fill groups table"
elif len(interp)==0:
msg = "Please choose interpolation method"
-
+
result = False
if len(msg)==0:
- iinterp = 0
- if "Linear" in interp:
- iinterp =1
- generate( path, calc_case, med_file, med_groups_regions, z_undef, iinterp )
+ generate( path, calc_case, med_file, med_groups_regions, z_undef, interp )
msg = "InterpolZ script is successfully generated"
result = True
-
+
QMessageBox.information( self, "", msg )
return result
-
+
def onClose( self ):
- self.close()
+ self.close()
"""Shows help page"""
def onHelp( self ):
# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
import os
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
-from PyQt5.QtWidgets import *
+from PyQt5.QtWidgets import QDialog , QFileDialog
import salome
from salome.hydro.pytel.genjob import generate_job
from genjobwindow_ui import Ui_GenJobDialog
-class GenJobDialog(QtGui.QDialog, Ui_GenJobDialog):
+class GenJobDialog(QDialog, Ui_GenJobDialog):
def __init__(self, parent, pytel_params):
- QtGui.QDialog.__init__(self, parent)
+ QDialog.__init__(self, parent)
self.setupUi(self)
- 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.dialogButtonBox.accepted.connect(self.validate)
+ self.dialogButtonBox.rejected.connect( self.close)
+ self.chooseInputDataDirectoryButton.clicked.connect( self.choose_input_dir)
+ self.chooseResultDirectoryButton.clicked.connect(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"])