MainWindow: Make toolbar run launch the lasest solver used and add sc on F6.

setup.py
Pierre-Antoine Rouby 2024-02-06 15:21:51 +01:00
parent 49dd3c65e1
commit 955af412ea
2 changed files with 39 additions and 29 deletions

View File

@ -175,7 +175,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self.findChild(QAction, action).setEnabled(enable) self.findChild(QAction, action).setEnabled(enable)
def setup_sc(self): def setup_sc(self):
# self._run_sc = QShortcut(QKeySequence("F5"), self) self._run_sc = QShortcut(QKeySequence("F6"), self)
return return
def setup_connection(self): def setup_connection(self):
@ -202,7 +202,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"action_menu_initial_conditions": self.open_initial_conditions, "action_menu_initial_conditions": self.open_initial_conditions,
"action_menu_edit_friction": self.open_frictions, "action_menu_edit_friction": self.open_frictions,
"action_menu_edit_lateral_contribution": self.open_lateral_contrib, "action_menu_edit_lateral_contribution": self.open_lateral_contrib,
"action_menu_run_solver": self.run_solver, "action_menu_run_solver": self.select_and_run_solver,
"action_menu_sediment_layers": self.open_sediment_layers, "action_menu_sediment_layers": self.open_sediment_layers,
"action_menu_edit_reach_sediment_layers": "action_menu_edit_reach_sediment_layers":
self.open_reach_sediment_layers, self.open_reach_sediment_layers,
@ -222,7 +222,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"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,
"action_toolBar_run_solver": self.run_solver, "action_toolBar_run_solver": self.run_lasest_solver,
# 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,
@ -243,7 +243,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
.triggered.connect(actions[action]) .triggered.connect(actions[action])
# action.triggered.connect(actions[action]) # action.triggered.connect(actions[action])
# self._run_sc.activated.connect(self.run_solver) self._run_sc.activated.connect(self.run_lasest_solver)
def changeEvent(self, event): def changeEvent(self, event):
if event.type() == QEvent.LanguageChange: if event.type() == QEvent.LanguageChange:
@ -808,7 +808,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
) )
sl.show() sl.show()
def run_solver(self): def run_lasest_solver(self):
if self._last_solver is None:
return
self.run_solver(self._last_solver)
def select_and_run_solver(self):
if self._study is None: if self._study is None:
return return
@ -818,25 +824,29 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
parent=self parent=self
) )
if run.exec(): if run.exec():
solver = run.solver self.run_solver(run.solver)
if self.sub_window_exists( def run_solver(self, solver):
CheckListWindow, if self._study is None:
data=[ return
self._study,
self.conf,
solver
]
):
return
check = CheckListWindow( if self.sub_window_exists(
study=self._study, CheckListWindow,
config=self.conf, data=[
solver=solver, self._study,
parent=self self.conf,
) solver
check.show() ]
):
return
check = CheckListWindow(
study=self._study,
config=self.conf,
solver=solver,
parent=self
)
check.show()
def solver_log(self, solver): def solver_log(self, solver):
sol = SolverLogWindow( sol = SolverLogWindow(

View File

@ -35,13 +35,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="pushButton_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="pushButton_run"> <widget class="QPushButton" name="pushButton_run">
<property name="text"> <property name="text">
@ -53,6 +46,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="pushButton_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>