1010
1111import sgtk
1212import datetime
13+ from functools import partial
1314import os
1415import sys
1516from sgtk .platform .qt import QtCore , QtGui
@@ -219,9 +220,8 @@ def get_actions_for_publishes(self, sg_data_list, ui_area):
219220 ]
220221
221222 # Bind all the action params to a single invocation of the _execute_hook.
222- a .triggered [()].connect (
223- lambda qt_action = a , actions = actions : self ._execute_hook (qt_action , actions )
224- )
223+ cb = partial (self ._execute_hook , a , actions )
224+ a .triggered [()].connect (cb )
225225 a .setData (actions )
226226 qt_actions .append (a )
227227
@@ -344,9 +344,8 @@ def get_actions_for_folder(self, sg_data):
344344 ]
345345
346346 # Bind all the action params to a single invocation of the _execute_hook.
347- a .triggered [()].connect (
348- lambda qt_action = a , actions = actions : self ._execute_hook (qt_action , actions )
349- )
347+ cb = partial (self ._execute_hook , a , actions )
348+ a .triggered [()].connect (cb )
350349 a .setData (actions )
351350 qt_actions .append (a )
352351
@@ -355,15 +354,18 @@ def get_actions_for_folder(self, sg_data):
355354 # Add the action only when there are some paths.
356355 if paths :
357356 fs = QtGui .QAction ("Show in the file system" , None )
358- fs .triggered [()].connect (lambda f = paths : self ._show_in_fs (f ))
357+ cb = partial (self ._show_in_fs , paths )
358+ fs .triggered [()].connect (cb )
359359 qt_actions .append (fs )
360360
361361 sg = QtGui .QAction ("Show details in Shotgun" , None )
362- sg .triggered [()].connect (lambda f = sg_data : self ._show_in_sg (f ))
362+ cb = partial (self ._show_in_sg , sg_data )
363+ sg .triggered [()].connect (cb )
363364 qt_actions .append (sg )
364365
365366 sr = QtGui .QAction ("Show in Media Center" , None )
366- sr .triggered [()].connect (lambda f = sg_data : self ._show_in_sr (f ))
367+ cb = partial (self ._show_in_sr , sg_data )
368+ sr .triggered [()].connect (cb )
367369 qt_actions .append (sr )
368370
369371 return qt_actions
0 commit comments