From 892068b3129e64f7132f8b3f1bfc8b901b654e01 Mon Sep 17 00:00:00 2001 From: Joe Hultgren Date: Sat, 15 Feb 2020 15:57:29 -0800 Subject: [PATCH 1/2] use a partial instead of lambda for menu actions In our custom engine the lambdas for any of the right click actions wouldn't work. Switching to a partial fixed things. Our engine is based off the unreal engine with the qt 5.6a framework --- python/tk_multi_workfiles/file_open_form.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/tk_multi_workfiles/file_open_form.py b/python/tk_multi_workfiles/file_open_form.py index de340ba3..7e8a4853 100644 --- a/python/tk_multi_workfiles/file_open_form.py +++ b/python/tk_multi_workfiles/file_open_form.py @@ -13,6 +13,8 @@ so that they can choose one to open """ +from functools import partial + import sgtk from sgtk.platform.qt import QtGui @@ -299,7 +301,7 @@ def _populate_open_menu(self, menu, file_actions): else: q_action = QtGui.QAction(action.label, menu) q_action.triggered[()].connect( - lambda a=action, checked=False: self._perform_action(a) + partial(self._preform_action, action) ) menu.addAction(q_action) add_separators = True From 1ee670088b4b0203195ad870e00d556f03821cf0 Mon Sep 17 00:00:00 2001 From: Joe Hultgren Date: Sat, 15 Feb 2020 16:04:23 -0800 Subject: [PATCH 2/2] fix typo --- python/tk_multi_workfiles/file_open_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tk_multi_workfiles/file_open_form.py b/python/tk_multi_workfiles/file_open_form.py index 7e8a4853..15915f1a 100644 --- a/python/tk_multi_workfiles/file_open_form.py +++ b/python/tk_multi_workfiles/file_open_form.py @@ -301,7 +301,7 @@ def _populate_open_menu(self, menu, file_actions): else: q_action = QtGui.QAction(action.label, menu) q_action.triggered[()].connect( - partial(self._preform_action, action) + partial(self._perform_action, action) ) menu.addAction(q_action) add_separators = True