Salome HOME
remove Mascaret and Coupling1D2D in GUI after merge branch yan/V8_3_BR
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 14 Jul 2017 20:16:56 +0000 (22:16 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 14 Jul 2017 20:16:56 +0000 (22:16 +0200)
src/HYDROGUI/HYDROSOLVERGUI.py

index 3803bef7eba26da122d6c35a06ccc1db863bbbb2..ac12d61056130d712def08f33d7f93d074374d59 100755 (executable)
@@ -36,9 +36,9 @@ 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
 import salome.hydro.study as hydro_study
-from salome.hydro.mascaret.eficas.appli import EficasForMascaretAppli
+#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.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 eficasSalome import runEficas
@@ -53,14 +53,14 @@ import BndConditionsDialog
 class GUIcontext:
     # menus/toolbars/actions IDs
     HYDRO_MENU_ID = 90
-    CREATE_MASCARET_CASE_ID = 941
-    RUN_MASCARET_ID = 942
-    EDIT_MASCARET_CASE_ID = 943
+    ##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
+    #CREATE_COUPLING1D2D_CASE_ID = 948
     EDIT_COUPLING1D2D_CASE_ID = 949
     OPEN_SCHEMA_IN_YACS_ID = 950
     CREATE_PYTEL_CASE_ID = 951
@@ -89,11 +89,11 @@ class GUIcontext:
         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_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",
@@ -101,11 +101,11 @@ class GUIcontext:
         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.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()
 
@@ -150,10 +150,10 @@ class GUIcontext:
 
 
         # 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.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" )
 
@@ -168,8 +168,8 @@ class GUIcontext:
         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.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" )
 
@@ -287,17 +287,17 @@ 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:
+        #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))
+        if 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))
             popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_YACS_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.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:
@@ -353,36 +353,36 @@ class MyTextDisplayDialog(Ui_TextDisplayDialog, QDialog):
 ###
 # Open Eficas for Mascaret to create a new case
 ###
-def create_mascaret_case():
-    EficasForMascaretAppli()
+#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())
+#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)
+#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():
@@ -473,14 +473,14 @@ def generate_telemac2d_yacs():
 ###
 # Open Eficas for 1D / 2D Coupling to create a new coupling case
 ###
-def create_coupling1d2d_case():
-    EficasForCoupling1D2DAppli()
+#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 edit_coupling1d2d_case():
+    #EficasForCoupling1D2DAppli(get_and_check_selected_file_path())
 
 def open_schema_in_yacs():
     ed = getStudyEditor()
@@ -529,17 +529,17 @@ def eficas_for_cas_Telemac2D_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.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.GEN_TELEMAC2D_YACS_ID: generate_telemac2d_yacs,
     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.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,