From d85e5c46666bd00d130d546ec0d25fa50e03cfc8 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Wed, 6 Dec 2023 11:28:24 +0100 Subject: [PATCH] PamhyrDialog: Fix window list delete whene dialog is done. --- src/View/Study/Window.py | 1 + src/View/Tools/ListedSubWindow.py | 3 ++- src/View/Tools/PamhyrWindow.py | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/View/Study/Window.py b/src/View/Study/Window.py index e8b9c7f8..bfb615d1 100644 --- a/src/View/Study/Window.py +++ b/src/View/Study/Window.py @@ -101,4 +101,5 @@ class NewStudyWindow(PamhyrDialog): self._study.use_date(date) else: self._study.use_time() + self.done(True) diff --git a/src/View/Tools/ListedSubWindow.py b/src/View/Tools/ListedSubWindow.py index 7fe21bb7..d0b833b8 100644 --- a/src/View/Tools/ListedSubWindow.py +++ b/src/View/Tools/ListedSubWindow.py @@ -55,11 +55,12 @@ class ListedSubWindow(object): logger.info(f"Close window: ({h}) {self.sub_win_cnt}") def _sub_win_exists(self, h): - return reduce( + res = reduce( lambda acc, el: (acc or (h == (el[1].hash()))), self.sub_win_list, False ) + return res def sub_win_exists(self, h): return self._sub_win_exists(h) diff --git a/src/View/Tools/PamhyrWindow.py b/src/View/Tools/PamhyrWindow.py index 74756167..87829b8d 100644 --- a/src/View/Tools/PamhyrWindow.py +++ b/src/View/Tools/PamhyrWindow.py @@ -186,3 +186,8 @@ class PamhyrDialog(ASubWindow, ListedSubWindow, PamhyrWindowTools): self._hash_data.append(self._config) self._set_title() + + def done(self, result): + if self.parent is not None: + self.parent.sub_win_del(self.hash()) + super(PamhyrDialog, self).done(result) -- GitLab