mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Allow to open last results from mainwindow.
parent
b1c658d711
commit
1a47bbe19d
|
|
@ -111,6 +111,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
self._study = None
|
self._study = None
|
||||||
|
|
||||||
# Results
|
# Results
|
||||||
|
self._last_solver = None
|
||||||
self._last_results = None
|
self._last_results = None
|
||||||
|
|
||||||
# UI
|
# UI
|
||||||
|
|
@ -150,6 +151,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing
|
Nothing
|
||||||
"""
|
"""
|
||||||
|
logger.debug(f"Set {action} to {enable}")
|
||||||
self.findChild(QAction, action).setEnabled(enable)
|
self.findChild(QAction, action).setEnabled(enable)
|
||||||
|
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
|
|
@ -180,6 +182,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
"action_menu_run_solver": self.run_solver,
|
"action_menu_run_solver": self.run_solver,
|
||||||
"action_menu_sediment_layers": self.open_sediment_layers,
|
"action_menu_sediment_layers": self.open_sediment_layers,
|
||||||
"action_menu_edit_reach_sediment_layers": self.open_reach_sediment_layers,
|
"action_menu_edit_reach_sediment_layers": self.open_reach_sediment_layers,
|
||||||
|
"action_menu_results_last": self.open_last_results,
|
||||||
## Help
|
## Help
|
||||||
"action_menu_about": self.open_about,
|
"action_menu_about": self.open_about,
|
||||||
# ToolBar action
|
# ToolBar action
|
||||||
|
|
@ -325,9 +328,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
for action in model_action:
|
for action in model_action:
|
||||||
self.enable_actions(action, not no_model)
|
self.enable_actions(action, not no_model)
|
||||||
|
|
||||||
def set_results(self, results):
|
def set_results(self, solver, results):
|
||||||
|
self._last_solver = solver
|
||||||
self._last_results = results
|
self._last_results = results
|
||||||
|
|
||||||
|
self.enable_actions("action_menu_results_last", True)
|
||||||
|
|
||||||
############
|
############
|
||||||
# FEATURES #
|
# FEATURES #
|
||||||
############
|
############
|
||||||
|
|
@ -703,6 +709,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
else:
|
else:
|
||||||
res.activateWindow()
|
res.activateWindow()
|
||||||
|
|
||||||
|
def open_last_results(self):
|
||||||
|
if self._last_solver is None or self._last_results is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.open_solver_results(self._last_solver, self._last_results)
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# DEBUG #
|
# DEBUG #
|
||||||
#########
|
#########
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,11 @@ class SolverLogWindow(PamhyrWindow):
|
||||||
if self._solver.log_file() != "":
|
if self._solver.log_file() != "":
|
||||||
self.find(QAction, "action_log_file").setEnabled(True)
|
self.find(QAction, "action_log_file").setEnabled(True)
|
||||||
|
|
||||||
|
# Get results
|
||||||
|
if self._results is None:
|
||||||
|
self._results = self._solver.results(self._study, self._workdir, qlog = self._output)
|
||||||
|
self._parent.set_results(self._solver, self._results)
|
||||||
|
|
||||||
while self._output.qsize() != 0:
|
while self._output.qsize() != 0:
|
||||||
s = self._output.get()
|
s = self._output.get()
|
||||||
if type(s) is str and "[ERROR]" in s:
|
if type(s) is str and "[ERROR]" in s:
|
||||||
|
|
@ -256,7 +261,7 @@ class SolverLogWindow(PamhyrWindow):
|
||||||
if self._results is None:
|
if self._results is None:
|
||||||
self._results = self._solver.results(self._study, self._workdir, qlog = self._output)
|
self._results = self._solver.results(self._study, self._workdir, qlog = self._output)
|
||||||
|
|
||||||
self._parent.set_results(self._results)
|
self._parent.set_results(self._solver, self._results)
|
||||||
self._parent.open_solver_results(self._solver, self._results)
|
self._parent.open_solver_results(self._solver, self._results)
|
||||||
|
|
||||||
def log_file(self):
|
def log_file(self):
|
||||||
|
|
|
||||||
|
|
@ -141,12 +141,11 @@
|
||||||
<addaction name="action_menu_edit_friction"/>
|
<addaction name="action_menu_edit_friction"/>
|
||||||
<addaction name="action_menu_edit_lateral_contribution"/>
|
<addaction name="action_menu_edit_lateral_contribution"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_plot">
|
<widget class="QMenu" name="menu_results">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Plots</string>
|
<string>&Results</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="action_plot_hydrograph"/>
|
<addaction name="action_menu_results_last"/>
|
||||||
<addaction name="action_plot_limnigram"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_cartography">
|
<widget class="QMenu" name="menu_cartography">
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
|
|
@ -178,7 +177,7 @@
|
||||||
<addaction name="menu_Hydraulics"/>
|
<addaction name="menu_Hydraulics"/>
|
||||||
<addaction name="menuSediment"/>
|
<addaction name="menuSediment"/>
|
||||||
<addaction name="menu_run"/>
|
<addaction name="menu_run"/>
|
||||||
<addaction name="menu_plot"/>
|
<addaction name="menu_results"/>
|
||||||
<addaction name="menu_cartography"/>
|
<addaction name="menu_cartography"/>
|
||||||
<addaction name="menu_help"/>
|
<addaction name="menu_help"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -597,12 +596,12 @@
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_plot_hydrograph">
|
<action name="action_menu_results_last">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hydrograph</string>
|
<string>Visualize last results</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue