Skip to content

Commit b0a69b9

Browse files
committed
node menu tweak.
1 parent b5c8a4b commit b0a69b9

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

NodeGraphQt/widgets/actions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ def __init__(self, *args, **kwargs):
99
super(BaseMenu, self).__init__(*args, **kwargs)
1010
self.setStyleSheet(STYLE_QMENU)
1111

12-
# def hideEvent(self, event):
13-
# super(BaseMenu, self).hideEvent(event)
14-
# print('foo')
12+
def hideEvent(self, event):
13+
super(BaseMenu, self).hideEvent(event)
14+
for a in self.actions():
15+
if hasattr(a, 'node_id'):
16+
a.node_id = None
1517

1618
def get_menu(self, name):
1719
for action in self.actions():

NodeGraphQt/widgets/viewer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ def contextMenuEvent(self, event):
163163
pos = self.mapToScene(self._previous_pos)
164164
items = self._items_near(pos)
165165
nodes = [i for i in items if isinstance(i, AbstractNodeItem)]
166-
# if nodes:
167-
# node = nodes[0]
168-
# ctx_menu = self._ctx_node_menu.get_menu(node.type_)
169-
# for action in ctx_menu.actions():
170-
# if not action.menu():
171-
# action.node_id = node.id
166+
if nodes:
167+
node = nodes[0]
168+
ctx_menu = self._ctx_node_menu.get_menu(node.type_)
169+
for action in ctx_menu.actions():
170+
if not action.menu():
171+
action.node_id = node.id
172172
if ctx_menu and ctx_menu.isEnabled():
173173
ctx_menu.exec_(event.globalPos())
174174
else:

0 commit comments

Comments
 (0)