From 7cce6095c4d1e6f4ec19814b059ca310048dcf4d Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 2 Feb 2017 11:53:54 +0100 Subject: [PATCH] activate pytel --- src/HYDROGUI/HYDROSOLVERGUI.py | 42 +++++++++++++-------------- src/salome_hydro/CMakeLists.txt | 2 +- src/salome_hydro/pytel/CMakeLists.txt | 11 ++++--- src/salome_hydro/pytel/gui.py | 8 ++--- 4 files changed, 33 insertions(+), 30 deletions(-) mode change 100644 => 100755 src/salome_hydro/pytel/CMakeLists.txt mode change 100644 => 100755 src/salome_hydro/pytel/gui.py diff --git a/src/HYDROGUI/HYDROSOLVERGUI.py b/src/HYDROGUI/HYDROSOLVERGUI.py index 8d59403..2821d4c 100755 --- a/src/HYDROGUI/HYDROSOLVERGUI.py +++ b/src/HYDROGUI/HYDROSOLVERGUI.py @@ -39,7 +39,7 @@ 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.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 import BndConditionsDialog @@ -62,9 +62,9 @@ class GUIcontext: 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 + 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 @@ -116,12 +116,12 @@ class GUIcontext: 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" ) + 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 ) + sgPyQt.createMenu( a, mid ) + sgPyQt.createTool( a, tid ) a = sgPyQt.createSeparator() sgPyQt.createMenu( a, mid ) @@ -152,10 +152,10 @@ class GUIcontext: 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.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") @@ -271,10 +271,10 @@ def createPopupMenu(popup, context): 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)) + 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)) # called when GUI action is activated # action ID is passed as parameter @@ -469,10 +469,10 @@ dict_command = { 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.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.GENERATE_INTERPOLZ_PY_ID: generate_interpolz_py, diff --git a/src/salome_hydro/CMakeLists.txt b/src/salome_hydro/CMakeLists.txt index b9c6674..5300240 100644 --- a/src/salome_hydro/CMakeLists.txt +++ b/src/salome_hydro/CMakeLists.txt @@ -17,7 +17,7 @@ ADD_SUBDIRECTORY(mascaret) ADD_SUBDIRECTORY(telemac2d) -#ADD_SUBDIRECTORY(pytel) +ADD_SUBDIRECTORY(pytel) ADD_SUBDIRECTORY(coupling1d2d) ADD_SUBDIRECTORY(boundary_conditions) diff --git a/src/salome_hydro/pytel/CMakeLists.txt b/src/salome_hydro/pytel/CMakeLists.txt old mode 100644 new mode 100755 index 0620de6..1c5645d --- a/src/salome_hydro/pytel/CMakeLists.txt +++ b/src/salome_hydro/pytel/CMakeLists.txt @@ -17,7 +17,7 @@ ADD_SUBDIRECTORY(eficas) -INCLUDE(UsePyQt5) +INCLUDE(UsePyQt) # --- Python files --- @@ -34,11 +34,14 @@ SET(UIFILES genjobwindow.ui ) +# scripts / pyuic wrappings +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${UIFILES}) + # --- rules --- # scripts / pyuic wrappings -PYQT4_WRAP_UIC(PYUICFILES ${UIFILES}) -SET(ALLPYFILES ${PYFILES} ${PYUICFILES}) +SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel) +INSTALL( FILES ${_pyuic_SCRIPTS} DESTINATION ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel) + -SALOME_INSTALL_SCRIPTS("${ALLPYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel) diff --git a/src/salome_hydro/pytel/gui.py b/src/salome_hydro/pytel/gui.py old mode 100644 new mode 100755 index 096405e..a84dd74 --- a/src/salome_hydro/pytel/gui.py +++ b/src/salome_hydro/pytel/gui.py @@ -26,10 +26,10 @@ from launcher import run_pytel from genjobwindow import GenJobDialog -def create_case(): +def create_case_pytel(): EficasForPytelAppli() -def edit_selected_case(): +def edit_selected_case_pytel(): EficasForPytelAppli(get_and_check_selected_file_path()) def get_params_from_selected_case(): @@ -42,11 +42,11 @@ def get_params_from_selected_case(): param_dict = jdc_to_dict(jdc, ["PYTEL", "_F"]) return param_dict -def run_selected_case(): +def run_selected_case_pytel(): param_dict = get_params_from_selected_case() run_pytel(param_dict) -def generate_job_for_selected_case(): +def generate_job_for_selected_case_pytel(): param_dict = get_params_from_selected_case() dialog = GenJobDialog(sgPyQt.getDesktop(), param_dict) dialog.exec_() -- 2.39.2