Commit 83d53a46 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Pamhyr: Add windows list recursively.

Showing with 29 additions and 13 deletions
+29 -13
...@@ -586,21 +586,34 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -586,21 +586,34 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# Remove all actions # Remove all actions
menu.clear() menu.clear()
self._do_update_window_list_add_action(menu, self.sub_win_list)
def _do_update_window_list_add_action(self, menu, win_list):
for _, win in win_list:
self._do_update_window_list_add_action_for_window(
menu, win
)
try:
lst = win.sub_win_list
self._do_update_window_list_add_action(menu, lst)
except Exception:
continue
def _do_update_window_list_add_action_for_window(self, menu, window):
def lambda_generator(h): def lambda_generator(h):
return lambda: self._activate_window(h) return lambda: self._activate_window(h)
# Add window action action = QAction(window._title, self)
for _, win in self.sub_win_list: # action.setStatusTip(
action = QAction(win._title, self) # _translate("MainWindowdow", "Activate this windowdow")
# action.setStatusTip( # )
# _translate("MainWindow", "Activate this window") h = window.hash()
# ) logger.info(f"Get hash: {h}")
h = win.hash() fn = lambda_generator(h)
logger.info(f"Get hash: {h}") action.triggered.connect(fn)
fn = lambda_generator(h)
action.triggered.connect(fn) menu.addAction(action)
menu.addAction(action)
def open_configure(self): def open_configure(self):
"""Open configure window """Open configure window
......
...@@ -108,4 +108,7 @@ class ListedSubWindow(object): ...@@ -108,4 +108,7 @@ class ListedSubWindow(object):
return False return False
def _update_window_list(self): def _update_window_list(self):
return try:
self._parent._update_window_list()
except Exception:
return
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment