import HYDROSOLVER_ORB
from salome.hydro.interpolz_gui import InterpolzDlg
-from salome.hydro.interpolks_gui import InterpolksDlg
-
-from salome.hydro.gui_utils import HSGUIException, wait_cursor, get_and_check_selected_file_path
+from salome.hydro.assignStrickler_gui import assignStricklerDlg
+from salome.hydro.changeCoordsDialog import changeCoordsDialog
+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.pytel.gui import create_case_pytel, run_selected_case_pytel, edit_selected_case_pytel, generate_job_for_selected_case_pytel
-#from salome.hydro.boundary_conditions.eficas.appli import EficasForBoundaryConditionsAppli
+from salome.hydro.run_study.eficas.appli import EficasForRunStudyAppli
+from salome.hydro.param_study.eficas.appli import EficasForParamStudyAppli
+from salome.hydro.telma.eficas.appli import EficasForTelmaAppli
+from salome.hydro.run_study.gui import create_case_study, \
+ run_selected_case_study, \
+ edit_selected_case_study, \
+ generate_job_for_selected_case_study
from eficasSalome import runEficas
from BndConditionsDialog import BoundaryConditionsDialog
-from LiquidBoundariesDialog import LiquidBoundariesDialog
-from BreachesDialog import BreachesDialog
-from InitialConditionsDialog import InitialConditionsDialog
+from salome.hydro.initialFieldDialog import initialFieldDialog
+from salome.hydro.checkBoundariesDialog import checkBoundariesDialog
+
################################################
# GUI context class
################################################
class GUIcontext:
-
- # --- menus/toolbars/actions IDs
-
+
+ # --- menus/toolbars/actions IDss
+
HYDRO_MENU_ID = 90
- #CREATE_MASCARET_CASE_ID = 941
- RUN_MASCARET_ID = 942
- #EDIT_MASCARET_CASE_ID = 943
- SHOW_LOG_ID = 944
- CREATE_TELEMAC2D_CASE_ID = 945
- OPEN_SCHEMA_IN_YACS_ID = 950
- CREATE_PYTEL_CASE_ID = 951
- RUN_PYTEL_ID = 952
- EDIT_PYTEL_CASE_ID = 953
- GENERATE_JOB = 954
- #DEFINE_BOUNDARY_CONDITIONS_ID = 955
- DEFINE_CAS_FILE_EN = 955
- EDIT_BOUNDARY_CONDITIONS_FILE_ID = 956
+ CREATE_STUDY_ID = 951
+ EDIT_STUDY_ID = 952
+ RUN_STUDY_ID = 953
+ GEN_STUDY_BATCH_ID = 954
+
+ CREATE_TELMA_CAS_ID = 955
+ EDIT_TELMA_CAS_ID = 956
+
GENERATE_INTERPOLZ_PY_ID = 957
- GEN_TELEMAC2D_PYTHON_ID = 958
- GEN_TELEMAC2D_YACS_ID = 959
- #DEFINE_CAS_FILE_FR = 960
- GENERATE_INTERPOLKS_PY_ID = 961
- EDIT_LIQUID_BOUNDARIES_FILE_ID = 962
- EDIT_BREACHES_FILE_ID = 962
- EDIT_INITIAL_CONDITIONS_FILE_ID = 963
-
- def __init__( self ):
- # --- create top-level menu
-
- mid = sgPyQt.createMenu( "Hydro", -1, GUIcontext.HYDRO_MENU_ID, sgPyQt.defaultMenuGroup() )
-
- # --- create toolbar
-
- tid = sgPyQt.createTool( "Hydro" )
-
- # --- create actions and fill menu and toolbar with actions
-
- a = sgPyQt.createAction( GUIcontext.GENERATE_INTERPOLZ_PY_ID,
- "Generate interpolZ.py", "Generate interpolZ.py",
- "Generate interpolation script for altitudes",
- "generate_interpolz_py.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.GENERATE_INTERPOLKS_PY_ID,
- "Generate interpolKS.py", "Generate interpolKS.py",
- "Generate interpolation script for bottom friction coefficients",
- "generate_interpolz_py.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createSeparator()
-
- a = sgPyQt.createAction( GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID,
- "Edit boundary conditions file", "Edit boundary conditions file",
- "Create/edit the boundary conditions file for Telemac",
- "edit_boundary_conditions_file.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.EDIT_LIQUID_BOUNDARIES_FILE_ID,
- "Edit liquid boundaries file", "Edit liquid boundaries file",
- "Create/edit the liquid boundaries file for Telemac",
- "edit_boundary_conditions_file.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.EDIT_BREACHES_FILE_ID,
- "Edit breaches file", "Edit breaches file",
- "Create/edit the breaches file for Telemac",
- "edit_boundary_conditions_file.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.EDIT_INITIAL_CONDITIONS_FILE_ID,
- "Edit initial conditions file", "Edit initial conditions file",
- "Create/edit the initial conditions file for Telemac",
- "edit_boundary_conditions_file.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_EN,
- "Edit cas file (English)", "Edit cas file (English)",
- "Create/edit a .cas file for Telemac (English)",
- "english.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createSeparator()
-
- 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 )
-
- #a = sgPyQt.createAction( GUIcontext.EDIT_PYTEL_CASE_ID,
- #"Edit case for Pytel execution", "Edit case for Pytel execution",
- #"Edit a new case for Pytel execution",
- #"case_pytel.png" )
- #sgPyQt.createMenu( a, mid )
- #sgPyQt.createTool( a, tid )
-
- #a = sgPyQt.createAction( GUIcontext.CREATE_MASCARET_CASE_ID,
- #"Create Mascaret case", "Create Mascaret case",
- #"Create a new Mascaret case",
- #"create_case1d.png" )
- #sgPyQt.createMenu( a, mid )
- #sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.CREATE_TELEMAC2D_CASE_ID,
- "Create Telemac2D case", "Create Telemac2D case",
- "Create a new Telemac2D case",
- "create_case2d.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createSeparator()
-
- #a = sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_FR,
- #"Edit cas file (French)", "Edit cas file (French)",
- #"Create/edit a .cas file for Telemac (French)",
- #"francais.png" )
- #sgPyQt.createMenu( a, mid )
- #sgPyQt.createTool( a, tid )
-
-
- # --- the following action are used in context popup
-
- sgPyQt.createAction( GUIcontext.RUN_MASCARET_ID, "Compute case", "Compute case",
- "Run Mascaret solver to compute the case" )
- #sgPyQt.createAction( GUIcontext.EDIT_MASCARET_CASE_ID, "Edit case", "Edit case",
- #"Edit the selected Mascaret case" )
- sgPyQt.createAction( GUIcontext.SHOW_LOG_ID, "Show log", "Show log",
- "Show the log for the selected variable" )
-
- sgPyQt.createAction( GUIcontext.GEN_TELEMAC2D_PYTHON_ID, "Generate Python script",
- "Generate Python script",
- "Generate a Python script from the eficas date" )
- sgPyQt.createAction( GUIcontext.GEN_TELEMAC2D_YACS_ID, "Generate YACS script",
- "Generate YACS script",
- "Generate a YACS script from the eficas date" )
-
- 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")
-
- sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_EN, "Edit .cas file", "Edit .cas file",
- "Edit .cas file")
- #sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_FR, "Edit .cas file (French)", "Edit .cas file (French)",
- #"Edit .cas file (French)")
+ GENERATE_ASSIGNSTRICKLER_PY_ID = 958
+
+ # TODO Add create and edit ?
+ EDIT_BOUNDARY_CONDITIONS_FILE_ID = 959
+ EDIT_INITIAL_FIELD_FILE_ID = 962
+
+ CREATE_PARAM_STUDY_ID = 963
+ EDIT_PARAM_STUDY_ID = 964
+ GEN_PARAM_STUDY_PYTHON_ID = 965
+ GEN_PARAM_STUDY_YACS_ID = 966
+
+ CHANGECOORDS_PY_ID = 967
+ CHECK_BOUNDARY_CONDITIONS_ID = 968
+
+ def __init__(self):
+ # create top-level menu
+ mid = sgPyQt.createMenu("Hydro", -1, GUIcontext.HYDRO_MENU_ID,
+ sgPyQt.defaultMenuGroup())
+ # create toolbar
+ tid = sgPyQt.createTool("Hydro")
+ # create actions and fill menu and toolbar with actions
+ act = sgPyQt.createAction(\
+ GUIcontext.CHANGECOORDS_PY_ID,
+ "Change coordinates",
+ "Change coordinates",
+ "Change mesh coordinates",
+ "changes_coords.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.GENERATE_INTERPOLZ_PY_ID,
+ "Generate interpolz.py",
+ "Generate interpolz.py",
+ "Generate interpolation script for altitudes",
+ "generate_interpolz_py.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.GENERATE_ASSIGNSTRICKLER_PY_ID,
+ "Generate assignStrickler.py",
+ "Generate assignStrickler.py",
+ "Generate assignation script for bottom friction coefficients",
+ "assign_Strickler_py.png" )
+ sgPyQt.createMenu( act, mid )
+ sgPyQt.createTool( act, tid )
+
+ act = sgPyQt.createSeparator()
+
+ act = sgPyQt.createAction(\
+ GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID,
+ "Edit boundary conditions file",
+ "Edit boundary conditions file",
+ "Create/edit the boundary conditions file for Telemac",
+ "edit_boundary_conditions_file.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CHECK_BOUNDARY_CONDITIONS_ID,
+ "check boundary conditions",
+ "check boundary conditions",
+ "display a graph with boundary conditions on the mesh",
+ "check_boundary_conditions.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.EDIT_INITIAL_FIELD_FILE_ID,
+ "Edit initial field file",
+ "Edit initial field file",
+ "Create/edit the initial field file for Telemac",
+ "edit_initial_field_file.png" )
+ sgPyQt.createMenu( act, mid )
+ sgPyQt.createTool( act, tid )
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_TELMA_CAS_ID,
+ "Edit cas file (English)",
+ "Edit cas file (English)",
+ "Create/edit act .cas file for Telemac (English)",
+ "create_telma_cas.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_STUDY_ID,
+ "Execute a steering file",
+ "Execute a steering file",
+ "Fill formular for a normal execution",
+ "create_study.png")
+
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_PARAM_STUDY_ID,
+ "Create Parameter Study",
+ "Create Parameter Study",
+ "Create act new Parameter Study",
+ "create_param_study.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createSeparator()
+
+ # the following action are used in context popup
+
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_PARAM_STUDY_ID,
+ "Edit param study",
+ "Edit param study",
+ "Edit study using python launcher")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_PARAM_STUDY_PYTHON_ID,
+ "Generate Python script",
+ "Generate Python script",
+ "Generate act Python script from the eficas date")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_PARAM_STUDY_YACS_ID,
+ "Generate YACS script",
+ "Generate YACS script",
+ "Generate act YACS script from the eficas date")
+
+ sgPyQt.createAction(\
+ GUIcontext.RUN_STUDY_ID,
+ "Compute study",
+ "Compute study",
+ "Compute study using python launcher")
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_STUDY_ID,
+ "Edit study",
+ "Edit study",
+ "Edit the selected study")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_STUDY_BATCH_ID,
+ "Generate batch job",
+ "Generate batch job",
+ "Generate a batch job to run the selected study")
+
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_TELMA_CAS_ID,
+ "Edit Steering file",
+ "Edit Steering file",
+ "Edit a Telemac-Mascaret steering file")
################################################
################################################
# study-to-context map
-__study2context__ = {}
+__study2context__ = {}
# current context
__current_context__ = None
# object counter
###
# get active study ID
###
-def _getStudyId():
- return sgPyQt.getStudyId()
+#def _getStudyId():
+ #return sgPyQt.getStudyId()
###
# get active study
###
-def _getStudy():
- studyId = _getStudyId()
- study = getStudyManager().GetStudyByID( studyId )
- return study
+#def _getStudy():
+ #studyId = _getStudyId()
+ #study = getStudyManager().GetStudyByID(studyId)
+ #return study
###
# returns True if object has children
###
-def _hasChildren( sobj ):
+def _hasChildren(sobj):
if sobj:
- study = _getStudy()
- iter = study.NewChildIterator( sobj )
+ study = salome.myStudy
+ iter = study.NewChildIterator(sobj)
while iter.More():
name = iter.Value().GetName()
if name:
# set and return current GUI context
# study ID is passed as parameter
###
-def _setContext( studyID ):
+def _setContext():
global __study2context__, __current_context__
- if not __study2context__.has_key(studyID):
- __study2context__[studyID] = GUIcontext()
- pass
- __current_context__ = __study2context__[studyID]
+ #if studyID not in __study2context__:
+ #__study2context__[studyID] = GUIcontext()
+ #pass
+ #__current_context__ = __study2context__[studyID]
+ __current_context__ = GUIcontext()
return __current_context__
###
# increment object counter in the map
###
-def _incObjToMap( m, id ):
+def _incObjToMap(m, id):
if id not in m: m[id] = 0
m[id] += 1
pass
# called when module is activated
# returns True if activating is successfull and False otherwise
def activate():
- ctx = _setContext( _getStudyId() )
+ ctx = _setContext()
return True
# called when module is deactivated
# called when active study is changed
# active study ID is passed as parameter
-def activeStudyChanged( studyID ):
- ctx = _setContext( _getStudyId() )
+def activeStudyChanged():
+ ctx = _setContext()
pass
# called when popup menu is invoked
# popup menu and menu context are passed as parameters
def createPopupMenu(popup, context):
ed = getStudyEditor()
- _setContext(ed.studyId)
+ _setContext()
if salome.sg.SelectedCount() == 1:
# one object is selected
sobj = ed.study.FindObjectID(salome.sg.getSelected(0))
- selectedType = ed.getTypeId(sobj)
- if selectedType == hydro_study.MASCARET_CASE_TYPE_ID:
- #popup.addAction(sgPyQt.action(GUIcontext.EDIT_MASCARET_CASE_ID))
- popup.addAction(sgPyQt.action(GUIcontext.RUN_MASCARET_ID))
- elif selectedType == hydro_study.TELEMAC2D_CASE_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_PYTHON_ID))
- popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_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))
+ print("sobj: %s"%sobj) # strange bug with sobj is None when right clic on 3Dview in HYDROSOLVER used after HYDRO (generate AssignStrickler)
+ if sobj:
+ selectedType = ed.getTypeId(sobj)
+ if selectedType == hydro_study.TELMA_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_TELMA_CAS_ID))
+ elif selectedType == hydro_study.PARAM_STUDY_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_PARAM_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_PYTHON_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_YACS_ID))
+ elif selectedType == hydro_study.STUDY_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.RUN_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_STUDY_BATCH_ID))
# called when GUI action is activated
# action ID is passed as parameter
-def OnGUIEvent( commandID ):
+def OnGUIEvent(commandID):
try:
dict_command[commandID]()
- except HSGUIException, exc:
+ except HSGUIException as exc:
QMessageBox.critical(sgPyQt.getDesktop(),
QApplication.translate("OnGUIEvent", "Error"),
- unicode(exc))
+ str(exc))
except:
logger.exception("Unhandled exception caught in HYDROSOLVER GUI")
msg = QApplication.translate("OnGUIEvent",
msgBox = QMessageBox(QMessageBox.Critical,
QApplication.translate("OnGUIEvent", "Error"),
msg,
- parent = sgPyQt.getDesktop())
+ parent=sgPyQt.getDesktop())
msgBox.setDetailedText(traceback.format_exc())
msgBox.exec_()
# GUI actions implementation
################################################
-# --------------------------------------------------------------------------------------- #
-# Dialog box for text display (deprecated, it was only used in the calcium coupling test) #
-# --------------------------------------------------------------------------------------- #
-"""
-from TextDisplayDialog import Ui_TextDisplayDialog
-
-class MyTextDisplayDialog(Ui_TextDisplayDialog, QDialog):
-
- def __init__(self, parent = None, modal = 0):
- QDialog.__init__(self, parent)
- Ui_TextDisplayDialog.__init__(self)
- self.setupUi(self)
- (self.closeButton.clicked.connect(self.close)
-
- def set_log(self, log):
- self.contentTextEdit.setPlainText(log)
- self.setWindowTitle("Coupling log")
-"""
-
-###
-# Open Eficas for Mascaret to create a new case
-###
-def create_mascaret_case():
- EficasForMascaretAppli()
-
-###
-# Open Eficas for Mascaret to edit the selected case
-###
-def edit_mascaret_case():
- EficasForMascaretAppli(get_and_check_selected_file_path())
-
-# Run Mascaret on selected case
-def run_mascaret():
- try:
- with wait_cursor:
- ed = hydro_study.HydroStudyEditor()
- sobj = ed.editor.study.FindObjectID(salome.sg.getSelected(0))
- (file_list, lig_file, input_vars, output_vars) = ed.get_mascaret_params_from_case(sobj)
- var_names = [var["NOM"].strip() for var in output_vars]
- mascaret_vars = [var["VARIABLE_MASCARET"].strip() for var in output_vars]
- engine = salome.lcc.FindOrLoadComponent("FactoryServer", "MASCARET")
- logger.debug("Calling MASCARET.Compute(%s, %s, %s)" %
- (file_list, lig_file, mascaret_vars))
- output_values = engine.Compute(file_list, lig_file, mascaret_vars)
- ed.add_results_to_mascaret_case(sobj, var_names, output_values)
- salome.sg.updateObjBrowser( 0 )
- except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
- msg = unicode(QApplication.translate("run_mascaret",
- "An error happened while trying to run Mascaret:"))
- msg += "\n" + exc.details.text
- raise HSGUIException(msg)
-
-# Display selected log (deprecated, it was only used in the calcium coupling test)
-def show_log():
- ed = hydro_study.HydroStudyEditor()
- sobj = ed.editor.study.FindObjectID(salome.sg.getSelected(0))
- if sobj is not None:
- (found, attr) = getStudyEditor().builder.FindAttribute(
- sobj, "AttributeParameter")
- log = attr.GetString("log")
- dialog = MyTextDisplayDialog(sgPyQt.getDesktop())
- dialog.set_log(log)
- dialog.show()
-
###
-# Open Eficas for Telemac2D to create a new case
+# Open Eficas for a new parametric study
###
-def create_telemac2d_case():
- EficasForTelemac2DAppli()
-
+def create_param_study():
+ EficasForParamStudyAppli()
###
-# Open Eficas for Telemac2D to edit the selected case
+# Open Eficas to edit a new parametric study
###
-def edit_telemac2d_case():
- EficasForTelemac2DAppli(get_and_check_selected_file_path())
+def edit_param_study():
+ EficasForParamStudyAppli(get_and_check_selected_file_path())
###
# Generate a python script from the eficas file
###
-def generate_telemac2d_python():
+def generate_param_study_python():
try:
with wait_cursor:
ed = hydro_study.HydroStudyEditor()
sobj = get_and_check_selected_file_path()
ed.generate_study_script(sobj)
- except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
- msg = unicode(QApplication.translate("generate_telemac2d_python",
+ except SALOME.SALOME_Exception as exc:
+ salome.sg.updateObjBrowser()
+ msg = str(QApplication.translate("generate_telemac2d_python",
"An error happened while trying to generate telemac2d Python script:"))
msg += "\n" + exc.details.text
raise HSGUIException(msg)
###
# Generate a python script from the eficas file
###
-def generate_telemac2d_yacs():
+def generate_param_study_yacs():
try:
with wait_cursor:
ed = hydro_study.HydroStudyEditor()
sobj = get_and_check_selected_file_path()
ed.generate_study_yacs(sobj)
- except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
- msg = unicode(QApplication.translate("generate_telemac2d_yacs",
+ except SALOME.SALOME_Exception as exc:
+ salome.sg.updateObjBrowser()
+ msg = str(QApplication.translate("generate_telemac2d_yacs",
"An error happened while trying to generate telemac2d Python script:"))
msg += "\n" + exc.details.text
raise HSGUIException(msg)
yg = salome.ImportComponentGUI("YACS")
yg.loadSchema(filename)
-###
-# Open Eficas for boundary conditions definition
-###
-#def define_boundary_conditions():
-# EficasForBoundaryConditionsAppli()
-
###
# Open dialog for boundary conditions edition
###
dlg.exec_()
###
-# Open dialog for liquid boundaries edition
-###
-def edit_liquid_boundaries_file():
- desktop = sgPyQt.getDesktop()
- dlg = LiquidBoundariesDialog(desktop)
- dlg.exec_()
-
-###
-# Open dialog for breaches edition
+# Open dialog for initial conditions edition
###
-def edit_breaches_file():
+def edit_initial_field_file():
desktop = sgPyQt.getDesktop()
- dlg = BreachesDialog(desktop)
+ dlg = initialFieldDialog(desktop)
dlg.exec_()
###
# Open dialog for initial conditions edition
###
-def edit_initial_conditions_file():
+def check_boundaries():
desktop = sgPyQt.getDesktop()
- dlg = InitialConditionsDialog(desktop)
+ dlg = checkBoundariesDialog(desktop)
dlg.exec_()
###
def generate_interpolz_py():
desktop = sgPyQt.getDesktop()
dlg = InterpolzDlg(desktop)
- dlg.show()
+ dlg.exec_()
###
-# Open dialog for interpolks.py script generation
+# Open dialog for assignStrickler.py script generation
###
-def generate_interpolks_py():
+def generate_assignStrickler_py():
desktop = sgPyQt.getDesktop()
- dlg = InterpolksDlg(desktop)
- dlg.show()
+ dlg = assignStricklerDlg(desktop)
+ dlg.exec_()
+
+def changeCoords_py():
+ desktop = sgPyQt.getDesktop()
+ dlg = changeCoordsDialog(desktop)
+ dlg.exec_()
###
# Open dialog for boundary conditions edition
###
-def eficas_for_cas_Telemac2D_fr():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'fr')
+def generate_interpolks_py():
+ QMessageBox.warning(sgPyQt.getDesktop(),
+ "",
+ "Generation of interpolks.py not implemented yet")
+ return
+
+###
+# Open dialog for creation of steering file
+###
+def create_telma_cas():
+ EficasForTelmaAppli(code='TELEMAC', lang='en')
-def eficas_for_cas_Telemac2D_en():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'en')
+###
+# Open dialog for edition of steering file
+###
+def edit_telma_cas():
+ # TODO: See how to detect module
+ EficasForTelmaAppli(fichier=get_and_check_selected_file_path(),
+ code='TELEMAC', lang='en')
###
# Commands dictionary
###
dict_command = {
- #GUIcontext.CREATE_MASCARET_CASE_ID: create_mascaret_case,
- GUIcontext.RUN_MASCARET_ID: run_mascaret,
- #GUIcontext.EDIT_MASCARET_CASE_ID: edit_mascaret_case,
- GUIcontext.SHOW_LOG_ID: show_log,
- GUIcontext.CREATE_TELEMAC2D_CASE_ID: create_telemac2d_case,
- GUIcontext.GEN_TELEMAC2D_PYTHON_ID: generate_telemac2d_python,
- GUIcontext.GEN_TELEMAC2D_YACS_ID: generate_telemac2d_yacs,
- GUIcontext.OPEN_SCHEMA_IN_YACS_ID: open_schema_in_yacs,
- GUIcontext.CREATE_PYTEL_CASE_ID: create_case_pytel,
- GUIcontext.RUN_PYTEL_ID: run_selected_case_pytel,
- GUIcontext.EDIT_PYTEL_CASE_ID: edit_selected_case_pytel,
- GUIcontext.GENERATE_JOB: generate_job_for_selected_case_pytel,
- #GUIcontext.DEFINE_BOUNDARY_CONDITIONS_ID: define_boundary_conditions,
- GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
- GUIcontext.EDIT_LIQUID_BOUNDARIES_FILE_ID: edit_liquid_boundaries_file,
- GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
- GUIcontext.EDIT_INITIAL_CONDITIONS_FILE_ID: edit_initial_conditions_file,
- GUIcontext.GENERATE_INTERPOLKS_PY_ID: generate_interpolks_py,
+ GUIcontext.CREATE_STUDY_ID: create_case_study,
+ GUIcontext.EDIT_STUDY_ID: edit_selected_case_study,
+ GUIcontext.RUN_STUDY_ID: run_selected_case_study,
+ GUIcontext.GEN_STUDY_BATCH_ID: generate_job_for_selected_case_study,
+ GUIcontext.CREATE_TELMA_CAS_ID: create_telma_cas,
+ GUIcontext.EDIT_TELMA_CAS_ID: edit_telma_cas,
GUIcontext.GENERATE_INTERPOLZ_PY_ID: generate_interpolz_py,
- GUIcontext.DEFINE_CAS_FILE_EN: eficas_for_cas_Telemac2D_en,
- #GUIcontext.DEFINE_CAS_FILE_FR: eficas_for_cas_Telemac2D_fr,
+ GUIcontext.GENERATE_ASSIGNSTRICKLER_PY_ID: generate_assignStrickler_py,
+ GUIcontext.CHANGECOORDS_PY_ID: changeCoords_py,
+ GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+ GUIcontext.CHECK_BOUNDARY_CONDITIONS_ID: check_boundaries,
+ GUIcontext.EDIT_INITIAL_FIELD_FILE_ID: edit_initial_field_file,
+ GUIcontext.CREATE_PARAM_STUDY_ID: create_param_study,
+ GUIcontext.EDIT_PARAM_STUDY_ID: edit_param_study,
+ GUIcontext.GEN_PARAM_STUDY_PYTHON_ID: generate_param_study_python,
+ GUIcontext.GEN_PARAM_STUDY_YACS_ID: generate_param_study_yacs,
}