Salome HOME
porting to SALOME 9.3: 2to3
[modules/hydrosolver.git] / src / HYDROGUI / HYDROSOLVERGUI.py
index 0b41bd0cc85eb9bb7bc2b36e260e5951dbd58268..1e62aff348163ed0c9dab04a2a511d44ee9b0096 100755 (executable)
@@ -33,17 +33,25 @@ 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.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
-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
 
-import BndConditionsDialog
+from BndConditionsDialog import BoundaryConditionsDialog
+from LiquidBoundariesDialog import LiquidBoundariesDialog
+from BreachesDialog import BreachesDialog
+from InitialConditionsDialog import InitialConditionsDialog
 
 ################################################
 # GUI context class
@@ -51,124 +59,164 @@ import BndConditionsDialog
 ################################################
 
 class GUIcontext:
-    # menus/toolbars/actions IDs
+  
+    # --- menus/toolbars/actions IDs
+    
     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
-    DEFINE_CAS_FILE = 955
-    EDIT_BOUNDARY_CONDITIONS_FILE_ID = 956
-    GENERATE_INTERPOLZ_PY_ID = 957
-    GEN_TELEMAC2D_PYTHON_ID = 958
-
-    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.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.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()
+    CREATE_STUDY_ID = 951
+    EDIT_STUDY_ID = 952
+    RUN_STUDY_ID = 953
+    GEN_STUDY_BATCH_ID = 954
 
-        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" )
+    CREATE_TELMA_CAS_ID = 955
+    EDIT_TELMA_CAS_ID = 956
 
-        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", "edit_case_pytel.png" )
-
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
-
-        a = sgPyQt.createSeparator()
-
-        a = sgPyQt.createAction( GUIcontext.GENERATE_INTERPOLZ_PY_ID,
-                                 "Generate interpolz.py", "Generate interpolz.py",
-                                 "Generate interpolation script from the template", "generate_interpolz_py.png" )
+    GENERATE_INTERPOLZ_PY_ID = 957
+    GENERATE_ASSIGNSTRICKLER_PY_ID = 958
 
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
+    # TODO Add create and edit ?
+    EDIT_BOUNDARY_CONDITIONS_FILE_ID = 959
+    EDIT_LIQUID_BOUNDARY_FILE_ID = 960
+    EDIT_BREACHES_FILE_ID = 961
+    EDIT_INITIAL_CONDITIONS_FILE_ID = 962
 
-        a = sgPyQt.createSeparator()
-        a = sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE,
-                                 "Edit cas file", "Edit cas file",
-                                 "Create/edit a .cas file for Telemac",
-                                 "define_cas_file.png" )
-        sgPyQt.createMenu( a, mid )
-        sgPyQt.createTool( a, tid )
+    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):
+        # 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.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",
+                 "generate_interpolz_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.EDIT_LIQUID_BOUNDARY_FILE_ID,
+                "Edit liquid boundary conditions file",
+                "Edit liquid boundary conditions file",
+                "Create/edit the liquid boundary conditions file for Telemac",
+                "edit_liquid_boundary_conditions_file.png")
+        sgPyQt.createMenu(act, mid)
+        sgPyQt.createTool(act, tid)
+
+        act = sgPyQt.createAction(\
+                GUIcontext.EDIT_BREACHES_FILE_ID,
+                "Edit breaches file",
+                "Edit breaches file",
+                "Create/edit the breaches file for Telemac",
+                "edit_breaches_file.png")
+        sgPyQt.createMenu(act, mid)
+        sgPyQt.createTool(act, tid)
+        
+        act = 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( 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.GEN_TELEMAC2D_PYTHON_ID, "Generate Python script", 
-                             "Generate Python script",
-                             "Run Telemac2D solver to compute the case" )
-        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.DEFINE_CAS_FILE, "Edit .cas file", "Edit .cas file",
-                             "Edit .cas file")
+
+        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")
 
 
 ################################################
@@ -176,7 +224,7 @@ class GUIcontext:
 ################################################
 
 # study-to-context map
-__study2context__   = {}
+__study2context__ = {}
 # current context
 __current_context__ = None
 # object counter
@@ -197,16 +245,16 @@ def _getStudyId():
 ###
 def _getStudy():
     studyId = _getStudyId()
-    study = getStudyManager().GetStudyByID( studyId )
+    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 )
+        iter  = study.NewChildIterator(sobj)
         while iter.More():
             name = iter.Value().GetName()
             if name:
@@ -227,9 +275,9 @@ def _getContext():
 # set and return current GUI context
 # study ID is passed as parameter
 ###
-def _setContext( studyID ):
+def _setContext(studyID):
     global __study2context__, __current_context__
-    if not __study2context__.has_key(studyID):
+    if studyID not in __study2context__:
         __study2context__[studyID] = GUIcontext()
         pass
     __current_context__ = __study2context__[studyID]
@@ -238,7 +286,7 @@ def _setContext( studyID ):
 ###
 # 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
@@ -250,7 +298,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(_getStudyId())
     return True
 
 # called when module is deactivated
@@ -259,8 +307,8 @@ def deactivate():
 
 # called when active study is changed
 # active study ID is passed as parameter
-def activeStudyChanged( studyID ):
-    ctx = _setContext( _getStudyId() )
+def activeStudyChanged(studyID):
+    ctx = _setContext(_getStudyId())
     pass
 
 # called when popup menu is invoked
@@ -272,32 +320,26 @@ def createPopupMenu(popup, context):
         # 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))
-            popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_PYTHON_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))
+        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",
@@ -307,7 +349,7 @@ def OnGUIEvent( commandID ):
         msgBox = QMessageBox(QMessageBox.Critical,
                                    QApplication.translate("OnGUIEvent", "Error"),
                                    msg,
-                                   parent = sgPyQt.getDesktop())
+                                   parent=sgPyQt.getDesktop())
         msgBox.setDetailedText(traceback.format_exc())
         msgBox.exec_()
 
@@ -315,143 +357,49 @@ 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, 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
+# 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())
-
-# 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()
+def edit_param_study():
+    EficasForParamStudyAppli(get_and_check_selected_file_path())
 
 ###
-# 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_python():
     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(QApplication.translate("run_telemac2d",
-                      "An error happened while trying to run Telemac2D:"))
+            sobj = get_and_check_selected_file_path()
+            ed.generate_study_script(sobj)
+    except SALOME.SALOME_Exception as exc:
+        salome.sg.updateObjBrowser(0)
+        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)
-    except Exception, exc:
-        logger.exception("An error happened in the computation (Telemac2D probably crashed).")
-        try:
-            engine.GetContainerRef().Shutdown()
-        except:
-            pass
-        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)
-        raise HSGUIException(msg)
 
 ###
 # Generate a python script from the eficas file
 ###
-def generate_telemac2d_python():
+def generate_param_study_yacs():
     try:
         with wait_cursor:
             ed = hydro_study.HydroStudyEditor()
             sobj = get_and_check_selected_file_path()
-            print sobj
-            ed.find_or_create_telemac2d_case(sobj)
-    except SALOME.SALOME_Exception, exc:
-        salome.sg.updateObjBrowser( 0 )
-        msg = unicode(QApplication.translate("generate_telemac2d_python",
+            ed.generate_study_yacs(sobj)
+    except SALOME.SALOME_Exception as exc:
+        salome.sg.updateObjBrowser(0)
+        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)
 
-
-###
-# 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()
     sobj = ed.study.FindObjectID(salome.sg.getSelected(0))
@@ -465,19 +413,57 @@ def open_schema_in_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 liquid boundaries edition
 ###
-def edit_boundary_conditions_file():
+def edit_liquid_boundaries_file():
+    desktop = sgPyQt.getDesktop()
+    dlg = LiquidBoundariesDialog(desktop)
+    dlg.exec_()
+
+###
+# Open dialog for breaches edition
+###
+def edit_breaches_file():
+    desktop = sgPyQt.getDesktop()
+    dlg = BreachesDialog(desktop)
+    dlg.exec_()
+
+###
+# Open dialog for initial conditions edition
+###
+def edit_initial_conditions_file():
     desktop = sgPyQt.getDesktop()
-    dlg = BndConditionsDialog.BoundaryConditionsDialog(desktop)
+    dlg = InitialConditionsDialog(desktop)
     dlg.exec_()
 
+###
+# Open dialog for liquid boundary conditions edition
+###
+def edit_liquid_boundary_file():
+    # TODO: Implement gui
+    QMessageBox.warning(sgPyQt.getDesktop(),
+                        "",
+                        "Liquid boundary file handling not implemented yet")
+    return
+
+###
+# Open dialog for breaches file edition
+###
+def edit_breaches_file():
+    # TODO: Implement gui
+    QMessageBox.warning(sgPyQt.getDesktop(),
+                        "",
+                        "Breaches file handling not implemented yet")
+    return
+
 ###
 # Open dialog for interpolz.py script generation
 ###
@@ -486,32 +472,55 @@ def generate_interpolz_py():
     dlg = InterpolzDlg(desktop)
     dlg.show()
 
+###
+# Open dialog for assignStrickler.py script generation
+###
+def generate_assignStrickler_py():
+    desktop = sgPyQt.getDesktop()
+    dlg = assignStricklerDlg(desktop)
+    dlg.show()
+
 ###
 # Open dialog for boundary conditions edition
 ###
-def eficas_for_cas_Telemac2D():
-   runEficas(code='TELEMAC')
+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.GEN_TELEMAC2D_PYTHON_ID: generate_telemac2d_python,
-    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: 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.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: eficas_for_cas_Telemac2D,
+    GUIcontext.GENERATE_ASSIGNSTRICKLER_PY_ID: generate_assignStrickler_py,
+    GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID: edit_liquid_boundary_file,
+    GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+    GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
+    GUIcontext.EDIT_INITIAL_CONDITIONS_FILE_ID: edit_initial_conditions_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,
     }