Skip to content

Commit 0997b25

Browse files
fix previous commit
1 parent 857a101 commit 0997b25

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

NodeGraphQt/widgets/actions.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,22 @@ def __init__(self, *args, **kwargs):
1919
# a.node_id = None
2020

2121
def get_menu(self, name, node_id=None):
22-
for action in self.actions():
23-
menu = action.parent()
24-
if not menu:
25-
continue
26-
if menu.title() == name:
27-
return menu
28-
if node_id and menu.node_class:
29-
node = menu.graph.get_node_by_id(node_id)
30-
if isinstance(node, menu.node_class):
31-
return menu
22+
for child in self.children():
23+
if isinstance(child, BaseMenu):
24+
if child.title() == name:
25+
return child
26+
if node_id and child.node_class:
27+
node = child.graph.get_node_by_id(node_id)
28+
if isinstance(node, child.node_class):
29+
return child
3230

3331
def get_menus(self, node_class):
3432
menus = []
35-
for action in self.actions():
36-
menu = action.parent()
37-
if menu.node_class:
38-
if issubclass(menu.node_class, node_class):
39-
menus.append(menu)
33+
for child in self.children():
34+
if isinstance(child, BaseMenu):
35+
if child.node_class:
36+
if issubclass(child.node_class, node_class):
37+
menus.append(child)
4038
return menus
4139

4240

0 commit comments

Comments
 (0)