Pamhyr: Chose to close all subwindow at window close.

setup.py
Pierre-Antoine Rouby 2024-02-13 11:43:24 +01:00
parent f0f6ad17e2
commit 8109ddf78f
3 changed files with 18 additions and 3 deletions

View File

@ -342,6 +342,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
def _do_propagate_update(self):
for key in self._propagation_keys:
if key == "window_list":
logger.debug(f"Update window list")
self._do_update_window_list()
continue
@ -568,9 +569,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
elif res == QMessageBox.Cancel:
return False
#############
# SUBWINDOW #
#############
#########################
# SUB WINDOWS MENU LIST #
#########################
def _activate_window(self, window_hash):
self._try_activate_window_for_window(self, window_hash)
@ -629,6 +630,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
menu.addAction(action)
###############
# SUB WINDOWS #
###############
def open_configure(self):
"""Open configure window

View File

@ -112,3 +112,7 @@ class ListedSubWindow(object):
self._parent._update_window_list()
except Exception:
return
def _close_sub_window(self):
for _, win in self._sub_win_list:
win.close()

View File

@ -172,6 +172,12 @@ class PamhyrWindow(ASubMainWindow, ListedSubWindow, PamhyrWindowTools):
self._set_title()
def closeEvent(self, event):
self._close_sub_window()
self._propagate_update("window_list")
super(PamhyrWindow, self).closeEvent(event)
class PamhyrDialog(ASubWindow, ListedSubWindow, PamhyrWindowTools):
_pamhyr_ui = "dummy"