42
42
43
43
import openshot
44
44
45
+
45
46
class PropertyDelegate (QItemDelegate ):
46
47
def __init__ (self , parent = None , * args ):
47
48
QItemDelegate .__init__ (self , parent , * args )
48
49
49
50
# pixmaps for curve icons
50
- self .curve_pixmaps = { openshot .BEZIER : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .BEZIER )),
51
- openshot .LINEAR : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .LINEAR )),
52
- openshot .CONSTANT : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .CONSTANT ))
53
- }
51
+ self .curve_pixmaps = {openshot .BEZIER : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .BEZIER )),
52
+ openshot .LINEAR : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .LINEAR )),
53
+ openshot .CONSTANT : QPixmap (os .path .join (info .IMAGES_PATH , "keyframe-%s.png" % openshot .CONSTANT ))
54
+ }
54
55
55
56
def paint (self , painter , option , index ):
56
57
painter .save ()
@@ -125,9 +126,9 @@ def paint(self, painter, option, index):
125
126
painter .setBrush (gradient )
126
127
path = QPainterPath ()
127
128
value_rect = QRectF (option .rect )
128
- path .addRoundedRect (value_rect , 15 , 15 );
129
+ path .addRoundedRect (value_rect , 15 , 15 )
129
130
painter .fillPath (path , gradient )
130
- painter .drawPath (path );
131
+ painter .drawPath (path )
131
132
painter .setClipping (False )
132
133
133
134
if points > 1 :
@@ -406,7 +407,11 @@ def contextMenuEvent(self, event=None, release=False):
406
407
fileParentPath = self .files_model .model .item (fileItem .row (), 4 ).text ()
407
408
408
409
# Append file choice
409
- file_choices .append ({"name" : fileName , "value" : os .path .join (fileParentPath , fileName ), "selected" : False , "icon" : fileIcon })
410
+ file_choices .append ({"name" : fileName ,
411
+ "value" : os .path .join (fileParentPath , fileName ),
412
+ "selected" : False ,
413
+ "icon" : fileIcon
414
+ })
410
415
411
416
# Add root file choice
412
417
self .choices .append ({"name" : _ ("Files" ), "value" : file_choices , "selected" : False })
@@ -421,20 +426,20 @@ def contextMenuEvent(self, event=None, release=False):
421
426
transPath = self .transition_model .model .item (transItem .row (), 3 ).text ()
422
427
423
428
# Append transition choice
424
- trans_choices .append ({"name" : transName , "value" : transPath , "selected" : False , "icon" : transIcon })
429
+ trans_choices .append ({"name" : transName , "value" : transPath , "selected" : False , "icon" : transIcon })
425
430
426
431
# Add root transitions choice
427
432
self .choices .append ({"name" : _ ("Transitions" ), "value" : trans_choices , "selected" : False })
428
433
429
434
# Handle reader type values
430
- if property_name == "Track" and self .property_type == "int" and not self .choices :
435
+ if property_name == "Track" and self .property_type == "int" and not self .choices :
431
436
# Populate all display track names
432
437
all_tracks = get_app ().project .get ("layers" )
433
438
display_count = len (all_tracks )
434
439
for track in reversed (sorted (all_tracks , key = itemgetter ('number' ))):
435
440
# Append track choice
436
441
track_name = track .get ("label" ) or _ ("Track %s" ) % display_count
437
- self .choices .append ({"name" : track_name , "value" : track .get ("number" ), "selected" : False })
442
+ self .choices .append ({"name" : track_name , "value" : track .get ("number" ), "selected" : False })
438
443
display_count -= 1
439
444
440
445
# Define bezier presets
@@ -680,7 +685,7 @@ def getMenu(self):
680
685
item_icon = QIcon (QPixmap (clip .data .get ('image' )))
681
686
action = menu .addAction (item_name )
682
687
action .setIcon (item_icon )
683
- action .setData ({'item_id' :item_id , 'item_type' :'clip' })
688
+ action .setData ({'item_id' : item_id , 'item_type' : 'clip' })
684
689
action .triggered .connect (self .Action_Triggered )
685
690
686
691
# Add effects for these clips (if any)
@@ -699,7 +704,7 @@ def getMenu(self):
699
704
trans = Transition .get (id = item_id )
700
705
if trans :
701
706
item_name = _ (trans .title ())
702
- item_icon = QIcon (QPixmap (trans .data .get ('reader' ,{}).get ('path' )))
707
+ item_icon = QIcon (QPixmap (trans .data .get ('reader' , {}).get ('path' )))
703
708
action = menu .addAction (_ (item_name ))
704
709
action .setIcon (item_icon )
705
710
action .setData ({'item_id' : item_id , 'item_type' : 'transition' })
@@ -793,7 +798,7 @@ def __init__(self, *args):
793
798
self .lblSelection .setTextFormat (Qt .RichText )
794
799
795
800
hbox = QHBoxLayout ()
796
- hbox .setContentsMargins (0 ,0 , 0 , 0 )
801
+ hbox .setContentsMargins (0 , 0 , 0 , 0 )
797
802
hbox .addWidget (self .lblSelection )
798
803
hbox .addWidget (self .btnSelectionName )
799
804
self .setLayout (hbox )
0 commit comments