1010
1111import sgtk
1212import datetime
13+ from functools import partial
1314import os
1415import sys
1516from sgtk .platform .qt import QtCore , QtGui
@@ -229,11 +230,8 @@ def get_actions_for_publishes(self, sg_data_list, ui_area):
229230 ]
230231
231232 # Bind all the action params to a single invocation of the _execute_hook.
232- a .triggered [()].connect (
233- lambda qt_action = a , actions = actions : self ._execute_hook (
234- qt_action , actions
235- )
236- )
233+ cb = partial (self ._execute_hook , a , actions )
234+ a .triggered [()].connect (cb )
237235 a .setData (actions )
238236 qt_actions .append (a )
239237
@@ -358,11 +356,8 @@ def get_actions_for_folder(self, sg_data):
358356 ]
359357
360358 # Bind all the action params to a single invocation of the _execute_hook.
361- a .triggered [()].connect (
362- lambda qt_action = a , actions = actions : self ._execute_hook (
363- qt_action , actions
364- )
365- )
359+ cb = partial (self ._execute_hook , a , actions )
360+ a .triggered [()].connect (cb )
366361 a .setData (actions )
367362 qt_actions .append (a )
368363
@@ -371,15 +366,18 @@ def get_actions_for_folder(self, sg_data):
371366 # Add the action only when there are some paths.
372367 if paths :
373368 fs = QtGui .QAction ("Show in the file system" , None )
374- fs .triggered [()].connect (lambda f = paths : self ._show_in_fs (f ))
369+ cb = partial (self ._show_in_fs , paths )
370+ fs .triggered [()].connect (cb )
375371 qt_actions .append (fs )
376372
377373 sg = QtGui .QAction ("Show details in Shotgun" , None )
378- sg .triggered [()].connect (lambda f = sg_data : self ._show_in_sg (f ))
374+ cb = partial (self ._show_in_sg , sg_data )
375+ sg .triggered [()].connect (cb )
379376 qt_actions .append (sg )
380377
381378 sr = QtGui .QAction ("Show in Media Center" , None )
382- sr .triggered [()].connect (lambda f = sg_data : self ._show_in_sr (f ))
379+ cb = partial (self ._show_in_sr , sg_data )
380+ sr .triggered [()].connect (cb )
383381 qt_actions .append (sr )
384382
385383 return qt_actions
0 commit comments