Skip to content

Commit 7598762

Browse files
committed
* Fixed bugs related to workflow tool context menus
1 parent 9d0f68d commit 7598762

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

nxt_editor/dockwidgets/widget_builder.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Built-in
22
import logging
3-
import ast
3+
from functools import partial
44
try:
55
from collections.abc import Iterable
66
except ImportError:
@@ -814,12 +814,12 @@ def __init__(self, node_path, parent=None):
814814
action = QtWidgets.QAction(text, self)
815815
if menu_data.get(self.SELECTOR_ITEM_ATTR) == 'True':
816816
title = menu_data.get(self.SELECTOR_TITLE_ATTR)
817-
action.triggered.connect(lambda p=menu_item_path, t=title:
818-
self.selection_widget(p, t))
817+
action.triggered.connect(partial(self.selection_widget,
818+
node_path, title))
819819
else:
820-
action.triggered.connect(lambda p=menu_item_path,
821-
a=self.ITEM_PATH_ATTR:
822-
self.execute_node_path(p, a))
820+
action.triggered.connect(partial(self.execute_node_path,
821+
menu_item_path,
822+
self.ITEM_PATH_ATTR))
823823
items.append(action)
824824

825825
ContextMenu(stage_model=self.stage_model,
@@ -870,9 +870,9 @@ def selection_widget(self, node_path, title):
870870
else:
871871
items = []
872872
# selector dialog
873-
screen = QtWidgets.QApplication.desktop().screenNumber(
874-
QtWidgets.QApplication.desktop().cursor().pos())
875-
center = QtWidgets.QApplication.desktop().screenGeometry(screen).center()
873+
cursor_pos = QtGui.QCursor.pos()
874+
screen = QtWidgets.QApplication.screenAt(cursor_pos)
875+
center = screen.geometry().center() if screen else QtCore.QPoint(0, 0)
876876
dialog = SelectionDialog(title=title, items=items, pos=center, parent=self)
877877
dialog.exec_()
878878
if not dialog.result():

0 commit comments

Comments
 (0)