10
10
11
11
import sgtk
12
12
import datetime
13
+ from functools import partial
13
14
import os
14
15
import sys
15
16
from sgtk .platform .qt import QtCore , QtGui
@@ -229,11 +230,8 @@ def get_actions_for_publishes(self, sg_data_list, ui_area):
229
230
]
230
231
231
232
# 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 )
237
235
a .setData (actions )
238
236
qt_actions .append (a )
239
237
@@ -358,11 +356,8 @@ def get_actions_for_folder(self, sg_data):
358
356
]
359
357
360
358
# 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 )
366
361
a .setData (actions )
367
362
qt_actions .append (a )
368
363
@@ -371,15 +366,18 @@ def get_actions_for_folder(self, sg_data):
371
366
# Add the action only when there are some paths.
372
367
if paths :
373
368
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 )
375
371
qt_actions .append (fs )
376
372
377
373
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 )
379
376
qt_actions .append (sg )
380
377
381
378
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 )
383
381
qt_actions .append (sr )
384
382
385
383
return qt_actions
0 commit comments