Salome HOME
[fix #22458 and #22201] wrong function to display dialog fro changecoordiantes
[modules/hydrosolver.git] / src / HYDROGUI / HYDROSOLVERGUI.py
old mode 100644 (file)
new mode 100755 (executable)
index 133e55c..8ab7a44
@@ -20,7 +20,7 @@ import os
 import traceback
 import logging
 
-from PyQt4 import QtCore, QtGui
+from PyQt5.QtWidgets import QMessageBox, QApplication, QDialog
 
 import salome
 import SALOME
@@ -33,16 +33,26 @@ logger = Logger("HYDROGUI", color = termcolor.BLUE)
 #logger.setLevel(logging.ERROR)
 
 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
+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.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.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 salome.hydro.initialFieldDialog import initialFieldDialog
+from salome.hydro.checkBoundariesDialog import checkBoundariesDialog
 
-import BndConditionsDialog
 
 ################################################
 # GUI context class
@@ -50,121 +60,173 @@ import BndConditionsDialog
 ################################################
 
 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
-    RUN_TELEMAC2D_ID = 946
-    EDIT_TELEMAC2D_CASE_ID = 947
-    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
-    GENERATE_JOB = 954
-    DEFINE_BOUNDARY_CONDITIONS_ID = 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
+    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
 
-    def __init__( self ):
+    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() )
+        mid = sgPyQt.createMenu("Hydro", -1, GUIcontext.HYDRO_MENU_ID,
+                                sgPyQt.defaultMenuGroup())
         # create toolbar
-        tid = sgPyQt.createTool( "Hydro" )
+        tid = sgPyQt.createTool("Hydro")
         # create actions and fill menu and toolbar with actions
-        a = sgPyQt.createAction( GUIcontext.DEFINE_BOUNDARY_CONDITIONS_ID,
-                                 "Define boundary conditions", "Define boundary conditions",
-                                 "Define the boundary conditions for Telemac",
-                                 "define_boundary_conditions.png" )
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
-
-        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.createSeparator()
-        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.createAction( GUIcontext.CREATE_COUPLING1D2D_CASE_ID,
-                                 "Create 1D / 2D coupling", "Create 1D / 2D coupling",
-                                 "Create a new 1D / 2D coupling", "create_case_couplage.png" )
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
-
-        a = sgPyQt.createSeparator()
-        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" )
-       
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
-
-        a = sgPyQt.createSeparator()
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
-
-        a = sgPyQt.createAction( GUIcontext.GENERATE_INTERPOLZ_PY_ID,
-                                 "Generate interpolz.py", "Generate interpolz.py",
-                                 "Generate interpolation script from the template", "generate_interpolz_py.png" )
-
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
+        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.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.RUN_TELEMAC2D_ID, "Compute case", "Compute case",
-                             "Run Telemac2D solver to compute the case" )
-        sgPyQt.createAction( GUIcontext.EDIT_TELEMAC2D_CASE_ID, "Edit case", "Edit case",
-                             "Edit the selected Telemac2D case" )
-
-        sgPyQt.createAction( GUIcontext.EDIT_COUPLING1D2D_CASE_ID, "Edit coupling", "Edit coupling",
-                             "Edit the selected 1D / 2D coupling" )
-        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.GENERATE_JOB, "Generate batch job", "Generate batch job",
-                             "Generate a batch job to run the selected case")
+
+        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")
+
 
 ################################################
 # Global variables
 ################################################
 
 # study-to-context map
-__study2context__   = {}
+__study2context__ = {}
 # current context
 __current_context__ = None
 # object counter
@@ -177,24 +239,24 @@ __objectid__ = 0
 ###
 # 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:
@@ -215,18 +277,19 @@ def _getContext():
 # 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
@@ -238,7 +301,7 @@ def _incObjToMap( m, id ):
 # 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
@@ -247,54 +310,51 @@ def deactivate():
 
 # 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.EDIT_TELEMAC2D_CASE_ID))
-            popup.addAction(sgPyQt.action(GUIcontext.RUN_TELEMAC2D_ID))
-        elif selectedType == hydro_study.COUPLING1D2D_CASE_TYPE_ID:
-            popup.addAction(sgPyQt.action(GUIcontext.EDIT_COUPLING1D2D_CASE_ID))
-            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))
+        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:
-        QtGui.QMessageBox.critical(sgPyQt.getDesktop(),
-                                   QtGui.QApplication.translate("OnGUIEvent", "Error"),
-                                   unicode(exc))
+    except HSGUIException as exc:
+        QMessageBox.critical(sgPyQt.getDesktop(),
+                                   QApplication.translate("OnGUIEvent", "Error"),
+                                   str(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())
+                                   parent=sgPyQt.getDesktop())
         msgBox.setDetailedText(traceback.format_exc())
         msgBox.exec_()
 
@@ -302,124 +362,48 @@ def OnGUIEvent( commandID ):
 # 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, QtGui.QDialog):
-
-    def __init__(self, parent = None, modal = 0):
-        QtGui.QDialog.__init__(self, parent)
-        Ui_TextDisplayDialog.__init__(self)
-        self.setupUi(self)
-        self.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.close)
-    
-    def set_log(self, log):
-        self.contentTextEdit.setPlainText(log)
-        self.setWindowTitle("Coupling log")
-"""
-
 ###
-# Open Eficas for Mascaret to create a new case
+# Open Eficas for a new parametric study
 ###
-def create_mascaret_case():
-    EficasForMascaretAppli()
-
+def create_param_study():
+    EficasForParamStudyAppli()
 ###
-# Open Eficas for Mascaret to edit the selected case
+# Open Eficas to edit a new parametric study
 ###
-def edit_mascaret_case():
-    EficasForMascaretAppli(get_and_check_selected_file_path())
+def edit_param_study():
+    EficasForParamStudyAppli(get_and_check_selected_file_path())
 
-# Run Mascaret on selected case
-def run_mascaret():
+###
+# Generate a python script from the eficas file
+###
+def generate_param_study_python():
     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(QtGui.QApplication.translate("run_mascaret",
-                      "An error happened while trying to run Mascaret:"))
+            sobj = get_and_check_selected_file_path()
+            ed.generate_study_script(sobj)
+    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)
 
-# 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
-###
-def create_telemac2d_case():
-    EficasForTelemac2DAppli()
-
 ###
-# Open Eficas for Telemac2D to edit the selected case
+# Generate a python script from the eficas file
 ###
-def edit_telemac2d_case():
-    EficasForTelemac2DAppli(get_and_check_selected_file_path())
-
-# Run Telemac2D on selected case
-def run_telemac2d():
-    engine = None
+def generate_param_study_yacs():
     try:
         with wait_cursor:
             ed = hydro_study.HydroStudyEditor()
-            entry = salome.sg.getSelected(0)
-            engine = salome.lcc.FindOrLoadComponent("Telemac2DContainer", "TELEMAC2D")
-            engine.Compute(ed.editor.studyId, entry)
-            # Stop container after execution so that we can use another fortran user file in the next run
-            engine.GetContainerRef().Shutdown()
-    except SALOME.SALOME_Exception, exc:
-        if engine is not None:
-            engine.GetContainerRef().Shutdown()
-        msg = unicode(QtGui.QApplication.translate("run_telemac2d",
-                      "An error happened while trying to run Telemac2D:"))
+            sobj = get_and_check_selected_file_path()
+            ed.generate_study_yacs(sobj)
+    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)
-    except Exception, exc:
-        logger.exception("An error happened in the computation (Telemac2D probably crashed).")
-        try:
-            engine.GetContainerRef().Shutdown()
-        except:
-            pass
-        msg = unicode(QtGui.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)
-        raise HSGUIException(msg)
-
-###
-# Open Eficas for 1D / 2D Coupling to create a new coupling case
-###
-def create_coupling1d2d_case():
-    EficasForCoupling1D2DAppli()
-
-###
-# Open Eficas for 1D / 2D Coupling to edit the selected coupling case
-###
-def edit_coupling1d2d_case():
-    EficasForCoupling1D2DAppli(get_and_check_selected_file_path())
 
 def open_schema_in_yacs():
     ed = getStudyEditor()
@@ -428,23 +412,33 @@ 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)
 
 ###
-# Open Eficas for boundary conditions definition
+# Open dialog for boundary conditions edition
 ###
-def define_boundary_conditions():
-    EficasForBoundaryConditionsAppli()
+def edit_boundary_conditions_file():
+    desktop = sgPyQt.getDesktop()
+    dlg = BoundaryConditionsDialog(desktop)
+    dlg.exec_()
 
 ###
-# Open dialog for boundary conditions edition
+# Open dialog for initial conditions edition
 ###
-def edit_boundary_conditions_file():
+def edit_initial_field_file():
+    desktop = sgPyQt.getDesktop()
+    dlg = initialFieldDialog(desktop)
+    dlg.exec_()
+
+###
+# Open dialog for initial conditions edition
+###
+def check_boundaries():
     desktop = sgPyQt.getDesktop()
-    dlg = BndConditionsDialog.BoundaryConditionsDialog(desktop)
+    dlg = checkBoundariesDialog(desktop)
     dlg.exec_()
 
 ###
@@ -453,27 +447,62 @@ def edit_boundary_conditions_file():
 def generate_interpolz_py():
     desktop = sgPyQt.getDesktop()
     dlg = InterpolzDlg(desktop)
-    dlg.show()
+    dlg.exec_()
+
+###
+# Open dialog for assignStrickler.py script generation
+###
+def generate_assignStrickler_py():
+    desktop = sgPyQt.getDesktop()
+    dlg = assignStricklerDlg(desktop)
+    dlg.exec_()
+
+def changeCoords_py():
+    desktop = sgPyQt.getDesktop()
+    dlg = changeCoordsDialog(desktop)
+    dlg.exec_()
+
+###
+# Open dialog for boundary conditions edition
+###
+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')
+
+###
+# 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.RUN_TELEMAC2D_ID: run_telemac2d,
-    GUIcontext.EDIT_TELEMAC2D_CASE_ID: edit_telemac2d_case,
-    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.DEFINE_BOUNDARY_CONDITIONS_ID: define_boundary_conditions,
-    GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+    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.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,
     }