PamhyrDialog: Fix window list delete whene dialog is done.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-12-06 11:30:09 +01:00
1 parent 45ee8a9662
commit d85e5c4666
3 files changed
+8 -1

No files matched your search

+1
View File
@@ -101,4 +101,5 @@ class NewStudyWindow(PamhyrDialog):
self._study.use_date(date) self._study.use_date(date)
else: else:
self._study.use_time() self._study.use_time()
self.done(True) self.done(True)
+2 -1
View File
@@ -55,11 +55,12 @@ class ListedSubWindow(object):
logger.info(f"Close window: ({h}) {self.sub_win_cnt}") logger.info(f"Close window: ({h}) {self.sub_win_cnt}")
def _sub_win_exists(self, h): def _sub_win_exists(self, h):
return reduce( res = reduce(
lambda acc, el: (acc or (h == (el[1].hash()))), lambda acc, el: (acc or (h == (el[1].hash()))),
self.sub_win_list, self.sub_win_list,
False False
) )
return res
def sub_win_exists(self, h): def sub_win_exists(self, h):
return self._sub_win_exists(h) return self._sub_win_exists(h)
+5
View File
@@ -186,3 +186,8 @@ class PamhyrDialog(ASubWindow, ListedSubWindow, PamhyrWindowTools):
self._hash_data.append(self._config) self._hash_data.append(self._config)
self._set_title() 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)