#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.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
################################################
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
- 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
- GENERATE_INTERPOLKS_PY_ID = 958
- GEN_TELEMAC2D_PYTHON_ID = 958
- GEN_TELEMAC2D_YACS_ID = 959
- #DEFINE_CAS_FILE_FR = 960
- GENERATE_ASSIGNSTRICKLER_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" )
++ GENERATE_ASSIGNSTRICKLER_PY_ID = 958
+
+ # 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
+
- CREATE_PARAM_STUDY_ID = 962
- EDIT_PARAM_STUDY_ID = 963
- GEN_PARAM_STUDY_PYTHON_ID = 964
- GEN_PARAM_STUDY_YACS_ID = 965
++ 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 from the template",
++ "Generate interpolation script for altitudes",
+ "generate_interpolz_py.png")
-
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
- # create actions and fill menu and toolbar with actions
+ act = sgPyQt.createAction(\
- GUIcontext.GENERATE_INTERPOLKS_PY_ID,
- "Generate interpolks.py",
- "Generate interpolks.py",
- "Generate friction coef script from the template",
- "generate_interpolks_py.png")
-
- sgPyQt.createMenu(act, mid)
- sgPyQt.createTool(act, tid)
-
++ 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 )
+
- # --- create actions and fill menu and toolbar with actions
+ 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)
+
- 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_ASSIGNSTRICKLER_PY_ID,
- "Generate assignStrickler.py", "Generate assignStrickler.py",
- "Generate assignation 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)")
++ 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.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")
################################################
###
def edit_boundary_conditions_file():
desktop = sgPyQt.getDesktop()
- dlg = BndConditionsDialog.BoundaryConditionsDialog(desktop)
+ dlg = BoundaryConditionsDialog(desktop)
+ 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
+ ###
+ 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 = 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
###
dlg.show()
###
- # Open dialog for interpolks.py script generation
+ # 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_fr():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'fr')
+def generate_interpolks_py():
+ QMessageBox.warning(sgPyQt.getDesktop(),
+ "",
+ "Generation of interpolks.py not implemented yet")
+ return
-def eficas_for_cas_Telemac2D_en():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'en')
+###
+# 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.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.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_INTERPOLKS_PY_ID: generate_interpolks_py,
++ 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_LIQUID_BOUNDARIES_FILE_ID: edit_liquid_boundaries_file,
GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
- GUIcontext.GENERATE_ASSIGNSTRICKLER_PY_ID: generate_assignStrickler_py,
- 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.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,
}