From 06b6d59494e4e0bfbd48a76c13135f5731ed31c8 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Fri, 4 Aug 2023 16:40:37 +0200 Subject: [PATCH] InitialConditions: Forbidden duplicate window. --- src/View/MainWindow.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index ad2e1c3c..0808ba8f 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -531,11 +531,19 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): def open_initial_conditions(self): if self.model.river.has_current_reach(): - initial = InitialConditionsWindow( - study = self.model, - parent = self + initial = self.sub_win_filter_first( + "Initial condition", + contain = [self.model.river.current_reach().name] ) - initial.show() + + if initial is None: + initial = InitialConditionsWindow( + study = self.model, + parent = self + ) + initial.show() + else: + initial.activateWindow() else: self.msg_select_reach() -- GitLab