MainWindow: Remove obsolete actions.

setup.py
Pierre-Antoine Rouby 2024-03-26 17:54:32 +01:00
parent 48aa5cb1aa
commit b9ace9f58f
2 changed files with 15 additions and 382 deletions

View File

@ -90,8 +90,7 @@ from Model.Study import Study
logger = logging.getLogger() logger = logging.getLogger()
no_model_action = [ no_model_action = [
"action_menu_new", "action_menu_open", "action_menu_import_mage", "action_menu_new", "action_menu_open", "action_toolBar_open",
"action_menu_import_rubarbe", "action_toolBar_open",
] ]
model_action = [ model_action = [
@ -101,17 +100,14 @@ model_action = [
] ]
other_model_action = [ other_model_action = [
"action_toolBar_run_solver", "action_toolBar_kill_solver" "action_toolBar_run_solver",
] ]
define_model_action = [ define_model_action = [
# Toolbar # Toolbar
"action_toolBar_network", "action_toolBar_geometry", "action_toolBar_network", "action_toolBar_geometry",
"action_toolBar_mesh", "action_toolBar_run_meshing_tool",
"action_toolBar_boundary_cond", "action_toolBar_lateral_contrib", "action_toolBar_boundary_cond", "action_toolBar_lateral_contrib",
"action_toolBar_spills", "action_toolBar_frictions", "action_toolBar_frictions", "action_toolBar_initial_cond",
"action_toolBar_stricklers", "action_toolBar_building",
"action_toolBar_initial_cond",
# Menu # Menu
"action_menu_run_solver", "action_menu_numerical_parameter", "action_menu_run_solver", "action_menu_numerical_parameter",
"action_menu_edit_network", "action_menu_edit_geometry", "action_menu_edit_network", "action_menu_edit_geometry",
@ -155,11 +151,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self self
) )
self.setup_debug_mode(init=True)
self.setup_tab() self.setup_tab()
self.setup_sc() self.setup_sc()
self.setup_connection() self.setup_connection()
self.default_style() self.default_style()
self.setup_debug_mode(init=True)
self.setup_results() self.setup_results()
self.setup_timer() self.setup_timer()
@ -218,8 +214,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
Returns: Returns:
Nothing Nothing
""" """
logger.debug(f"Set {action} to {enable}") qaction = self.findChild(QAction, action)
self.findChild(QAction, action).setEnabled(enable) if qaction is not None:
qaction.setEnabled(enable)
else:
logger.warning(f"Set {action} to {enable}")
def setup_sc(self): def setup_sc(self):
self._run_sc = QShortcut(QKeySequence("F6"), 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_mage": self.open_doc_mage,
"action_menu_about": self.open_about, "action_menu_about": self.open_about,
# ToolBar action # ToolBar action
"action_toolBar_quit": self.close,
"action_toolBar_open": self.open_model, "action_toolBar_open": self.open_model,
"action_toolBar_save": self.save_study, "action_toolBar_save": self.save_study,
"action_toolBar_close": self.close_model, "action_toolBar_close": self.close_model,
@ -277,22 +275,18 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# Current actions # Current actions
"action_toolBar_network": self.open_network, "action_toolBar_network": self.open_network,
"action_toolBar_geometry": self.open_geometry, "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_boundary_cond": self.open_boundary_cond,
"action_toolBar_lateral_contrib": self.open_lateral_contrib, "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_frictions": self.open_frictions,
"action_toolBar_building": lambda: self.open_dummy("Ouvrages"),
"action_toolBar_initial_cond": self.open_initial_conditions, "action_toolBar_initial_cond": self.open_initial_conditions,
} }
for action in actions: for action in actions:
logger.debug("Setup connection : " + action) qaction = self.findChild(QAction, action)
self.findChild(QAction, action)\ if qaction is not None:
.triggered.connect(actions[action]) qaction.triggered.connect(actions[action])
# action.triggered.connect(actions[action]) else:
logger.warning(f"Setup connection : '{action}' to {actions[action]}")
self._run_sc.activated.connect(self.run_lasest_solver) self._run_sc.activated.connect(self.run_lasest_solver)

View File

@ -157,15 +157,6 @@
<addaction name="action_menu_results_last"/> <addaction name="action_menu_results_last"/>
<addaction name="action_open_results_from_file"/> <addaction name="action_open_results_from_file"/>
</widget> </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"> <widget class="QMenu" name="menu_help">
<property name="title"> <property name="title">
<string>&amp;Help</string> <string>&amp;Help</string>
@ -225,7 +216,6 @@
<addaction name="menu_Avensed"/> <addaction name="menu_Avensed"/>
<addaction name="menu_run"/> <addaction name="menu_run"/>
<addaction name="menu_results"/> <addaction name="menu_results"/>
<addaction name="menu_cartography"/>
<addaction name="menu_windows"/> <addaction name="menu_windows"/>
<addaction name="menu_help"/> <addaction name="menu_help"/>
</widget> </widget>
@ -343,25 +333,6 @@
<string>Ctrl+O</string> <string>Ctrl+O</string>
</property> </property>
</action> </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"> <action name="action_menu_close">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -374,17 +345,6 @@
<string>Close current study</string> <string>Close current study</string>
</property> </property>
</action> </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"> <action name="action_menu_save">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -415,11 +375,6 @@
<string>Ctrl+Shift+S</string> <string>Ctrl+Shift+S</string>
</property> </property>
</action> </action>
<action name="action_menu_archive">
<property name="text">
<string>Archive</string>
</property>
</action>
<action name="action_menu_config"> <action name="action_menu_config">
<property name="text"> <property name="text">
<string>Pamhyr configuration</string> <string>Pamhyr configuration</string>
@ -450,83 +405,6 @@
<string>Edit geometry</string> <string>Edit geometry</string>
</property> </property>
</action> </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"> <action name="action_menu_numerical_parameter">
<property name="text"> <property name="text">
<string>Numerical parameter for solvers</string> <string>Numerical parameter for solvers</string>
@ -548,25 +426,6 @@
<string>Initial conditions</string> <string>Initial conditions</string>
</property> </property>
</action> </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"> <action name="action_menu_edit_friction">
<property name="text"> <property name="text">
<string>Edit friction</string> <string>Edit friction</string>
@ -577,27 +436,6 @@
<string>Edit lateral contributions</string> <string>Edit lateral contributions</string>
</property> </property>
</action> </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"> <action name="action_menu_run_solver">
<property name="text"> <property name="text">
<string>Run solver</string> <string>Run solver</string>
@ -606,34 +444,6 @@
<string>F5</string> <string>F5</string>
</property> </property>
</action> </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"> <action name="action_menu_results_last">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -648,61 +458,11 @@
<font/> <font/>
</property> </property>
</action> </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"> <action name="action_menu_about">
<property name="text"> <property name="text">
<string>About</string> <string>About</string>
</property> </property>
</action> </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"> <action name="action_toolBar_save">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -733,21 +493,6 @@
<string>Ctrl+F</string> <string>Ctrl+F</string>
</property> </property>
</action> </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"> <action name="action_toolBar_run_solver">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -760,51 +505,6 @@
<string>Run a solver</string> <string>Run a solver</string>
</property> </property>
</action> </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"> <action name="action_toolBar_network">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -829,18 +529,6 @@
<string>Edit reach geometry</string> <string>Edit reach geometry</string>
</property> </property>
</action> </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"> <action name="action_toolBar_boundary_cond">
<property name="text"> <property name="text">
<string>Boundary conditions</string> <string>Boundary conditions</string>
@ -860,14 +548,6 @@
<string>Edit lateral contribution</string> <string>Edit lateral contribution</string>
</property> </property>
</action> </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"> <action name="action_toolBar_frictions">
<property name="text"> <property name="text">
<string>Friction</string> <string>Friction</string>
@ -876,22 +556,6 @@
<string>Edit friction frictions</string> <string>Edit friction frictions</string>
</property> </property>
</action> </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"> <action name="action_menu_edit">
<property name="icon"> <property name="icon">
<iconset> <iconset>
@ -901,17 +565,7 @@
<string>Edit study</string> <string>Edit study</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Edit the study metadata</string> <string>Edit the study information</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>
</property> </property>
</action> </action>
<action name="action_toolBar_initial_cond"> <action name="action_toolBar_initial_cond">
@ -935,16 +589,6 @@
<string>Edit reach sediment layers</string> <string>Edit reach sediment layers</string>
</property> </property>
</action> </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"> <action name="action_menu_mage">
<property name="text"> <property name="text">
<string>Mage</string> <string>Mage</string>
@ -958,11 +602,6 @@
<string>Users (wiki)</string> <string>Users (wiki)</string>
</property> </property>
</action> </action>
<action name="action_menu_pamhyr_users_html">
<property name="text">
<string>Users (html)</string>
</property>
</action>
<action name="action_menu_pamhyr_developers_pdf"> <action name="action_menu_pamhyr_developers_pdf">
<property name="text"> <property name="text">
<string>Developers (pdf)</string> <string>Developers (pdf)</string>