mirror of https://gitlab.com/pamhyr/pamhyr2
Pamhyr: Add windows list recursively.
parent
a8c8e14d6a
commit
83d53a46fb
|
|
@ -586,16 +586,29 @@ 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 = QAction(window._title, self)
|
||||
# action.setStatusTip(
|
||||
# _translate("MainWindow", "Activate this window")
|
||||
# _translate("MainWindowdow", "Activate this windowdow")
|
||||
# )
|
||||
h = win.hash()
|
||||
h = window.hash()
|
||||
logger.info(f"Get hash: {h}")
|
||||
fn = lambda_generator(h)
|
||||
action.triggered.connect(fn)
|
||||
|
|
|
|||
|
|
@ -108,4 +108,7 @@ class ListedSubWindow(object):
|
|||
return False
|
||||
|
||||
def _update_window_list(self):
|
||||
try:
|
||||
self._parent._update_window_list()
|
||||
except Exception:
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue