mirror of https://gitlab.com/pamhyr/pamhyr2
Pamhyr: Add windows list recursively.
parent
a8c8e14d6a
commit
83d53a46fb
|
|
@ -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):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _update_window_list(self):
|
def _update_window_list(self):
|
||||||
return
|
try:
|
||||||
|
self._parent._update_window_list()
|
||||||
|
except Exception:
|
||||||
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue