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):
# Remove all actions
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):
return lambda: self._activate_window(h)
# Add window action
for _, win in self.sub_win_list:
action = QAction(win._title, self)
# action.setStatusTip(
# _translate("MainWindow", "Activate this window")
# )
h = win.hash()
logger.info(f"Get hash: {h}")
fn = lambda_generator(h)
action.triggered.connect(fn)
menu.addAction(action)
action = QAction(window._title, self)
# action.setStatusTip(
# _translate("MainWindowdow", "Activate this windowdow")
# )
h = window.hash()
logger.info(f"Get hash: {h}")
fn = lambda_generator(h)
action.triggered.connect(fn)
menu.addAction(action)
def open_configure(self):
"""Open configure window
......
......@@ -108,4 +108,7 @@ class ListedSubWindow(object):
return False
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