From 289c8ed12923b4f3fd03d22a509d8c2e5c165623 Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Fri, 4 Aug 2023 15:32:09 +0200
Subject: [PATCH] Geometry: Profile: Forbidden duplicate window for profile
 editing.

---
 src/View/Geometry/Window.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/View/Geometry/Window.py b/src/View/Geometry/Window.py
index 851b73bb..e33b6d54 100644
--- a/src/View/Geometry/Window.py
+++ b/src/View/Geometry/Window.py
@@ -184,13 +184,20 @@ class GeometryWindow(ASubMainWindow, ListedSubWindow):
         for row in rows:
             profile = self._reach.profile(row)
 
-            win = ProfileWindow(
-                profile = profile,
-                parent = self,
+            win = self.sub_win_filter_first(
+                "Profile",
+                contain = [self._reach.name, str(profile.kp)]
             )
 
-            self._profile_window.append(win)
-            win.show()
+            if win is None:
+                win = ProfileWindow(
+                    profile = profile,
+                    parent = self,
+                )
+                self._profile_window.append(win)
+                win.show()
+            else:
+                win.activateWindow()
 
         self.tableView.model().blockSignals(False)
 
-- 
GitLab