PamhyrDialog: Fix window list delete whene dialog is done.

setup.py
Pierre-Antoine Rouby 2023-12-06 11:28:24 +01:00
parent 45ee8a9662
commit d85e5c4666
3 changed files with 8 additions and 1 deletions

View File

@ -101,4 +101,5 @@ class NewStudyWindow(PamhyrDialog):
self._study.use_date(date)
else:
self._study.use_time()
self.done(True)

View File

@ -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)

View File

@ -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)