MainWindow: Display message when there are no current reach.

results
Pierre-Antoine Rouby 2023-07-05 11:46:04 +02:00
parent b1ea642f1c
commit 4ed1aef4a5
1 changed files with 17 additions and 8 deletions

View File

@ -289,6 +289,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# SUBWINDOW # # SUBWINDOW #
############# #############
def msg_select_reach(self):
self.message_box("Please select a reach",
"Geometry edition need a reach selected "
"into river network window to work on it")
def open_configure(self): def open_configure(self):
"""Open configure window """Open configure window
@ -371,9 +376,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
geometry = GeometryWindow(model=self.model, parent=self) geometry = GeometryWindow(model=self.model, parent=self)
geometry.show() geometry.show()
else: else:
self.message_box("Please select a reach", self.msg_select_reach()
"Geometry edition need a reach selected "
"into river network window to work on it")
def open_boundary_cond(self): def open_boundary_cond(self):
bound = BoundaryConditionWindow(study = self.model, parent = self) bound = BoundaryConditionWindow(study = self.model, parent = self)
@ -392,11 +395,15 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
strick.show() strick.show()
def open_sections(self): def open_sections(self):
sections = SectionsWindow( if (self.model is not None and
study = self.model, self.model.river.has_current_reach()):
parent = self sections = SectionsWindow(
) study = self.model,
sections.show() parent = self
)
sections.show()
else:
self.msg_select_reach()
def open_initial_conditions(self): def open_initial_conditions(self):
if self.model.river.has_current_reach(): if self.model.river.has_current_reach():
@ -405,6 +412,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
parent = self parent = self
) )
initial.show() initial.show()
else:
self.msg_select_reach()
def open_solver_parameters(self): def open_solver_parameters(self):
params = SolverParametersWindow( params = SolverParametersWindow(