@@ -195,7 +195,7 @@ def __init__(self, clip_id, effect_name, effect_params):
195
195
# flag to close the clip processing thread
196
196
self .cancel_clip_processing = False
197
197
self .effect = None
198
-
198
+
199
199
def spinner_value_changed (self , widget , param , value ):
200
200
"""Spinner value change callback"""
201
201
self .context [param ["setting" ]] = value
@@ -250,20 +250,21 @@ def rect_select_clicked(self, widget, param):
250
250
viewPortSize = win .viewport_rect
251
251
252
252
# Get QImage of region
253
- region_qimage = win .videoPreview .region_qimage
253
+ if win .videoPreview .region_qimage :
254
+ region_qimage = win .videoPreview .region_qimage
254
255
255
- # Resize QImage to match button size
256
- resized_qimage = region_qimage .scaled (widget .size (), Qt .IgnoreAspectRatio , Qt .SmoothTransformation )
256
+ # Resize QImage to match button size
257
+ resized_qimage = region_qimage .scaled (widget .size (), Qt .IgnoreAspectRatio , Qt .SmoothTransformation )
257
258
258
- # Draw Qimage onto QPushButton (to display region selection to user)
259
- palette = widget .palette ()
260
- palette .setBrush (widget .backgroundRole (), QBrush (resized_qimage ))
261
- widget .setFlat (True )
262
- widget .setAutoFillBackground (True )
263
- widget .setPalette (palette )
259
+ # Draw Qimage onto QPushButton (to display region selection to user)
260
+ palette = widget .palette ()
261
+ palette .setBrush (widget .backgroundRole (), QBrush (resized_qimage ))
262
+ widget .setFlat (True )
263
+ widget .setAutoFillBackground (True )
264
+ widget .setPalette (palette )
264
265
265
- # Remove button text (so region QImage is more visible)
266
- widget .setText ("" )
266
+ # Remove button text (so region QImage is more visible)
267
+ widget .setText ("" )
267
268
268
269
# If data found, add to context
269
270
if topLeft and bottomRight :
@@ -326,18 +327,17 @@ def accept(self):
326
327
# if the cancel button was pressed, close the processing thread
327
328
if (self .cancel_clip_processing ):
328
329
processing .CancelProcessing ()
330
+ break
329
331
330
332
if (not self .cancel_clip_processing ):
331
-
333
+
332
334
# Load processed data into effect
333
335
self .effect = openshot .EffectInfo ().CreateEffect (self .effect_name )
334
336
self .effect .SetJson ( '{"protobuf_data_path": "%s"}' % protobufPath )
335
337
self .effect .Id (ID )
336
-
337
- print ("Applied effect: %s to clip: %s" % (self .effect_name , self .clip_instance .Id ()))
338
338
339
- # Accept dialog
340
- super (ProcessEffect , self ).accept ()
339
+ # Accept dialog
340
+ super (ProcessEffect , self ).accept ()
341
341
342
342
def reject (self ):
343
343
# Cancel dialog
@@ -364,7 +364,7 @@ def generateJson(self, protobufPath):
364
364
trackerType = self .context ["tracker-type" ]
365
365
jsonString += ',"tracker_type": "%s"' % trackerType
366
366
367
- # Get bounding box coordinates
367
+ # Get bounding box coordinates
368
368
tracker_dict = self .context ["region" ]
369
369
bbox = (tracker_dict ["x" ],tracker_dict ["y" ],tracker_dict ["width" ],tracker_dict ["height" ])
370
370
jsonString += ',"bbox": {"x": %d, "y": %d, "w": %d, "h": %d}' % (bbox )
@@ -380,7 +380,7 @@ def generateJson(self, protobufPath):
380
380
381
381
modelConfigPath = self .context ["model-config" ]
382
382
jsonString += ', "model_configuration": "%s"' % modelConfigPath
383
-
383
+
384
384
classNamesPath = self .context ["class-names" ]
385
385
jsonString += ', "classes_file": "%s"' % classNamesPath
386
386
@@ -389,4 +389,4 @@ def generateJson(self, protobufPath):
389
389
390
390
# Finish JSON string
391
391
jsonString += '}'
392
- return jsonString
392
+ return jsonString
0 commit comments