Commit b9ace9f5 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

MainWindow: Remove obsolete actions.

No related merge requests found
Pipeline #54432 passed with stages
in 3 minutes and 38 seconds
Showing with 15 additions and 382 deletions
+15 -382
......@@ -90,8 +90,7 @@ from Model.Study import Study
logger = logging.getLogger()
no_model_action = [
"action_menu_new", "action_menu_open", "action_menu_import_mage",
"action_menu_import_rubarbe", "action_toolBar_open",
"action_menu_new", "action_menu_open", "action_toolBar_open",
]
model_action = [
......@@ -101,17 +100,14 @@ model_action = [
]
other_model_action = [
"action_toolBar_run_solver", "action_toolBar_kill_solver"
"action_toolBar_run_solver",
]
define_model_action = [
# Toolbar
"action_toolBar_network", "action_toolBar_geometry",
"action_toolBar_mesh", "action_toolBar_run_meshing_tool",
"action_toolBar_boundary_cond", "action_toolBar_lateral_contrib",
"action_toolBar_spills", "action_toolBar_frictions",
"action_toolBar_stricklers", "action_toolBar_building",
"action_toolBar_initial_cond",
"action_toolBar_frictions", "action_toolBar_initial_cond",
# Menu
"action_menu_run_solver", "action_menu_numerical_parameter",
"action_menu_edit_network", "action_menu_edit_geometry",
......@@ -155,11 +151,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self
)
self.setup_debug_mode(init=True)
self.setup_tab()
self.setup_sc()
self.setup_connection()
self.default_style()
self.setup_debug_mode(init=True)
self.setup_results()
self.setup_timer()
......@@ -218,8 +214,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
Returns:
Nothing
"""
logger.debug(f"Set {action} to {enable}")
self.findChild(QAction, action).setEnabled(enable)
qaction = self.findChild(QAction, action)
if qaction is not None:
qaction.setEnabled(enable)
else:
logger.warning(f"Set {action} to {enable}")
def setup_sc(self):
self._run_sc = QShortcut(QKeySequence("F6"), self)
......@@ -269,7 +268,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"action_menu_mage": self.open_doc_mage,
"action_menu_about": self.open_about,
# ToolBar action
"action_toolBar_quit": self.close,
"action_toolBar_open": self.open_model,
"action_toolBar_save": self.save_study,
"action_toolBar_close": self.close_model,
......@@ -277,22 +275,18 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# Current actions
"action_toolBar_network": self.open_network,
"action_toolBar_geometry": self.open_geometry,
"action_toolBar_mesh": lambda: self.open_dummy("Mesh"),
"action_toolBar_run_meshing_tool": self.open_solver_parameters,
"action_toolBar_boundary_cond": self.open_boundary_cond,
"action_toolBar_lateral_contrib": self.open_lateral_contrib,
"action_toolBar_spills": lambda: self.open_dummy("Deversement"),
"action_toolBar_stricklers": self.open_stricklers,
"action_toolBar_frictions": self.open_frictions,
"action_toolBar_building": lambda: self.open_dummy("Ouvrages"),
"action_toolBar_initial_cond": self.open_initial_conditions,
}
for action in actions:
logger.debug("Setup connection : " + action)
self.findChild(QAction, action)\
.triggered.connect(actions[action])
# action.triggered.connect(actions[action])
qaction = self.findChild(QAction, action)
if qaction is not None:
qaction.triggered.connect(actions[action])
else:
logger.warning(f"Setup connection : '{action}' to {actions[action]}")
self._run_sc.activated.connect(self.run_lasest_solver)
......
......@@ -157,15 +157,6 @@
<addaction name="action_menu_results_last"/>
<addaction name="action_open_results_from_file"/>
</widget>
<widget class="QMenu" name="menu_cartography">
<property name="locale">
<locale language="English" country="Europe"/>
</property>
<property name="title">
<string>&amp;Cartography</string>
</property>
<addaction name="action_map_current_reach"/>
</widget>
<widget class="QMenu" name="menu_help">
<property name="title">
<string>&amp;Help</string>
......@@ -225,7 +216,6 @@
<addaction name="menu_Avensed"/>
<addaction name="menu_run"/>
<addaction name="menu_results"/>
<addaction name="menu_cartography"/>
<addaction name="menu_windows"/>
<addaction name="menu_help"/>
</widget>
......@@ -343,25 +333,6 @@
<string>Ctrl+O</string>
</property>
</action>
<action name="action_menu_import_mage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Import data from MAGE</string>
</property>
<property name="statusTip">
<string/>
</property>
</action>
<action name="action_menu_import_rubarbe">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Import data from RubarBE</string>
</property>
</action>
<action name="action_menu_close">
<property name="icon">
<iconset>
......@@ -374,17 +345,6 @@
<string>Close current study</string>
</property>
</action>
<action name="action_menu_save_mesh">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Save mesh</string>
</property>
</action>
<action name="action_menu_save">
<property name="icon">
<iconset>
......@@ -415,11 +375,6 @@
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="action_menu_archive">
<property name="text">
<string>Archive</string>
</property>
</action>
<action name="action_menu_config">
<property name="text">
<string>Pamhyr configuration</string>
......@@ -450,83 +405,6 @@
<string>Edit geometry</string>
</property>
</action>
<action name="action_menu_import_geometry">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Import geometry</string>
</property>
</action>
<action name="action_menu_export_geometry">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export geometry</string>
</property>
</action>
<action name="action_menu_run_meshing_tool">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Run extrenal meshing tool</string>
</property>
</action>
<action name="action">
<property name="text">
<string>choose meshing tool by reach</string>
</property>
</action>
<action name="action_menu_view_mesh">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>View meshed geometry</string>
</property>
</action>
<action name="action_menu_export_mesh">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export mesh</string>
</property>
</action>
<action name="action_menu_delete_mesh_for_current_reach">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete mesh of current reach</string>
</property>
</action>
<action name="action_menu_delete_mesh">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete all mesh</string>
</property>
</action>
<action name="action_menu_abscisse_cote">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Abscisse - Cote</string>
</property>
</action>
<action name="action_menu_XYZ">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>XYZ</string>
</property>
</action>
<action name="action_menu_numerical_parameter">
<property name="text">
<string>Numerical parameter for solvers</string>
......@@ -548,25 +426,6 @@
<string>Initial conditions</string>
</property>
</action>
<action name="action_initia_conditions_export">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export initial conditions</string>
</property>
</action>
<action name="action_import_final_conditions_as_initial">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Import final state as initial condition</string>
</property>
</action>
<action name="action_menu_edit_friction">
<property name="text">
<string>Edit friction</string>
......@@ -577,27 +436,6 @@
<string>Edit lateral contributions</string>
</property>
</action>
<action name="action_edit_spills">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Edit spills</string>
</property>
</action>
<action name="action_dition_des_Tron_ons">
<property name="text">
<string>Édition des Tronçons</string>
</property>
</action>
<action name="action_edi_cross_building">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Edit cross building</string>
</property>
</action>
<action name="action_menu_run_solver">
<property name="text">
<string>Run solver</string>
......@@ -606,34 +444,6 @@
<string>F5</string>
</property>
</action>
<action name="action_stop_solver">
<property name="text">
<string>Stop solver</string>
</property>
</action>
<action name="action_display_listings">
<property name="text">
<string>Display listings</string>
</property>
</action>
<action name="action_simulation_directory_management">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Simulation directory management</string>
</property>
</action>
<action name="action_open">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="action_close">
<property name="text">
<string>Close</string>
</property>
</action>
<action name="action_menu_results_last">
<property name="enabled">
<bool>false</bool>
......@@ -648,61 +458,11 @@
<font/>
</property>
</action>
<action name="action_plot_limnigram">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Limnigram</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</action>
<action name="action_map_current_reach">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Map current reach</string>
</property>
</action>
<action name="action_menu_help_pamhyr">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Help PAMHYR</string>
</property>
</action>
<action name="action_menu_help_mage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Help MAGE</string>
</property>
</action>
<action name="action_menu_about">
<property name="text">
<string>About</string>
</property>
</action>
<action name="actionouvrir">
<property name="icon">
<iconset>
<normaloff>../ressources/menu/open.png</normaloff>../ressources/menu/open.png</iconset>
</property>
<property name="text">
<string>ouvrir</string>
</property>
<property name="toolTip">
<string>Ouvrir une étude</string>
</property>
</action>
<action name="action_toolBar_save">
<property name="icon">
<iconset>
......@@ -733,21 +493,6 @@
<string>Ctrl+F</string>
</property>
</action>
<action name="action_toolBar_quit">
<property name="icon">
<iconset>
<normaloff>ressources/exit_bis.png</normaloff>ressources/exit_bis.png</iconset>
</property>
<property name="text">
<string>Quit</string>
</property>
<property name="toolTip">
<string>Quit the application (Ctrl+Q)</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="action_toolBar_run_solver">
<property name="icon">
<iconset>
......@@ -760,51 +505,6 @@
<string>Run a solver</string>
</property>
</action>
<action name="action_toolBar_kill_solver">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/gtk-stop.png</normaloff>ressources/gtk-stop.png</iconset>
</property>
<property name="text">
<string>stop solver</string>
</property>
<property name="toolTip">
<string>Interrompt la simulation en cours</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="action_toolBar_run_meshing_tool">
<property name="icon">
<iconset>
<normaloff>ressources/gnome-stock-insert-table.png</normaloff>ressources/gnome-stock-insert-table.png</iconset>
</property>
<property name="text">
<string>Run external meshing tool</string>
</property>
<property name="toolTip">
<string>Run meshing tool on current reach geometry</string>
</property>
</action>
<action name="action_toolBar_listing">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/gnome-stock-edit.png</normaloff>ressources/gnome-stock-edit.png</iconset>
</property>
<property name="text">
<string>Display simulation listing</string>
</property>
<property name="toolTip">
<string>Display current simulation listing</string>
</property>
</action>
<action name="action_toolBar_network">
<property name="icon">
<iconset>
......@@ -829,18 +529,6 @@
<string>Edit reach geometry</string>
</property>
</action>
<action name="action_toolBar_mesh">
<property name="icon">
<iconset>
<normaloff>ressources/mailles-50.png</normaloff>ressources/mailles-50.png</iconset>
</property>
<property name="text">
<string>Mesh</string>
</property>
<property name="toolTip">
<string>Display meshed reach</string>
</property>
</action>
<action name="action_toolBar_boundary_cond">
<property name="text">
<string>Boundary conditions</string>
......@@ -860,14 +548,6 @@
<string>Edit lateral contribution</string>
</property>
</action>
<action name="action_toolBar_spills">
<property name="text">
<string>Spills</string>
</property>
<property name="toolTip">
<string>Edit lateral spills</string>
</property>
</action>
<action name="action_toolBar_frictions">
<property name="text">
<string>Friction</string>
......@@ -876,22 +556,6 @@
<string>Edit friction frictions</string>
</property>
</action>
<action name="action_toolBar_stricklers">
<property name="text">
<string>Stricklers</string>
</property>
<property name="toolTip">
<string>Edit the study stricklers</string>
</property>
</action>
<action name="action_toolBar_building">
<property name="text">
<string>Building</string>
</property>
<property name="toolTip">
<string>Edit building (valve, ...), singularity and pump</string>
</property>
</action>
<action name="action_menu_edit">
<property name="icon">
<iconset>
......@@ -901,17 +565,7 @@
<string>Edit study</string>
</property>
<property name="toolTip">
<string>Edit the study metadata</string>
</property>
</action>
<action name="action_english">
<property name="text">
<string>English</string>
</property>
</action>
<action name="action_french">
<property name="text">
<string>French</string>
<string>Edit the study information</string>
</property>
</action>
<action name="action_toolBar_initial_cond">
......@@ -935,16 +589,6 @@
<string>Edit reach sediment layers</string>
</property>
</action>
<action name="actionDoc">
<property name="text">
<string>Doc</string>
</property>
</action>
<action name="action_menu_Pamhyr_dev">
<property name="text">
<string>Pamhyr2 developer</string>
</property>
</action>
<action name="action_menu_mage">
<property name="text">
<string>Mage</string>
......@@ -958,11 +602,6 @@
<string>Users (wiki)</string>
</property>
</action>
<action name="action_menu_pamhyr_users_html">
<property name="text">
<string>Users (html)</string>
</property>
</action>
<action name="action_menu_pamhyr_developers_pdf">
<property name="text">
<string>Developers (pdf)</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment