From 4d1eb0fecc5ad5fdfd4adf9ceed450b6bc33a452 Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Fri, 20 Oct 2023 16:55:06 +0200
Subject: [PATCH] View: Fix results window open.

---
 src/View/MainWindow.py     | 31 +++++++++++++++++--------------
 src/View/Results/Window.py |  3 +++
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py
index 11604503..27e09ad1 100644
--- a/src/View/MainWindow.py
+++ b/src/View/MainWindow.py
@@ -793,21 +793,24 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
             return
 
         # Windows already opened
-        res = self.sub_win_filter_first(
-            "Results",
-            contain=[solver.name, results.date]
-        )
+        if self._sub_window_exists(
+                ResultsWindow,
+                data=[
+                    self._study,
+                    None,       # No config
+                    solver,
+                    results
+                ]
+        ):
+            return
 
-        if res is None:
-            res = ResultsWindow(
-                study=self._study,
-                solver=solver,
-                results=results,
-                parent=self
-            )
-            res.show()
-        else:
-            res.activateWindow()
+        res = ResultsWindow(
+            study=self._study,
+            solver=solver,
+            results=results,
+            parent=self
+        )
+        res.show()
 
     def open_last_results(self):
         if self._last_solver is None or self._last_results is None:
diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py
index 9d5d0f95..d4115507 100644
--- a/src/View/Results/Window.py
+++ b/src/View/Results/Window.py
@@ -91,6 +91,9 @@ class ResultsWindow(PamhyrWindow):
             parent=parent
         )
 
+        self._hash_data.append(self._solver)
+        self._hash_data.append(self._results)
+
         self._additional_plot = {}
 
         self.setup_table()
-- 
GitLab