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
@@ -219,9 +220,8 @@ def get_actions_for_publishes(self, sg_data_list, ui_area):
219
220
]
220
221
221
222
# 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 )
225
225
a .setData (actions )
226
226
qt_actions .append (a )
227
227
@@ -344,9 +344,8 @@ def get_actions_for_folder(self, sg_data):
344
344
]
345
345
346
346
# 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 )
350
349
a .setData (actions )
351
350
qt_actions .append (a )
352
351
@@ -355,15 +354,18 @@ def get_actions_for_folder(self, sg_data):
355
354
# Add the action only when there are some paths.
356
355
if paths :
357
356
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 )
359
359
qt_actions .append (fs )
360
360
361
361
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 )
363
364
qt_actions .append (sg )
364
365
365
366
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 )
367
369
qt_actions .append (sr )
368
370
369
371
return qt_actions
0 commit comments