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

MainWindow: Display message when there are no current reach.

Showing with 17 additions and 8 deletions
+17 -8
...@@ -289,6 +289,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -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): ...@@ -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): ...@@ -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): ...@@ -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(
......
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