diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 7953f3e308df53823814bf41a77cd188a317898b..2691855c51d1dadbb4a3d53f77da866d5401fe88 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -289,6 +289,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): # 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): """Open configure window @@ -371,9 +376,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): geometry = GeometryWindow(model=self.model, parent=self) geometry.show() else: - self.message_box("Please select a reach", - "Geometry edition need a reach selected " - "into river network window to work on it") + self.msg_select_reach() def open_boundary_cond(self): bound = BoundaryConditionWindow(study = self.model, parent = self) @@ -392,11 +395,15 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): strick.show() def open_sections(self): - sections = SectionsWindow( - study = self.model, - parent = self - ) - sections.show() + if (self.model is not None and + self.model.river.has_current_reach()): + sections = SectionsWindow( + study = self.model, + parent = self + ) + sections.show() + else: + self.msg_select_reach() def open_initial_conditions(self): if self.model.river.has_current_reach(): @@ -405,6 +412,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): parent = self ) initial.show() + else: + self.msg_select_reach() def open_solver_parameters(self): params = SolverParametersWindow(