29
29
import time
30
30
import json
31
31
import functools
32
+ import webbrowser
32
33
33
34
from PyQt5 .QtCore import *
34
35
from PyQt5 .QtGui import QBrush
@@ -93,6 +94,12 @@ def __init__(self, clip_id, effect_name, effect_params):
93
94
label .setText (_ (param ["title" ]))
94
95
label .setToolTip (_ (param ["title" ]))
95
96
97
+ if param ["type" ] == "link" :
98
+ # create a clickable link
99
+ label .setText ('<a href="%s" style="color: #FFFFFF">%s</a>' % (param ["value" ], param ["title" ]))
100
+ label .setTextInteractionFlags (Qt .TextBrowserInteraction )
101
+ label .linkActivated .connect (functools .partial (self .link_activated , widget , param ))
102
+
96
103
if param ["type" ] == "spinner" :
97
104
# create QDoubleSpinBox
98
105
widget = QDoubleSpinBox ()
@@ -178,13 +185,17 @@ def __init__(self, clip_id, effect_name, effect_params):
178
185
widget .currentIndexChanged .connect (functools .partial (self .dropdown_index_changed , widget , param ))
179
186
180
187
# Add Label and Widget to the form
181
- if ( widget and label ) :
188
+ if widget and label :
182
189
# Add minimum size
183
190
label .setSizePolicy (QSizePolicy .Minimum , QSizePolicy .Preferred )
184
191
widget .setSizePolicy (QSizePolicy .Expanding , QSizePolicy .Expanding )
185
192
186
193
# Create HBoxLayout for each field
187
- self .scrollAreaWidgetContents .layout ().insertRow (row_count - 1 , label , widget )
194
+ self .scrollAreaWidgetContents .layout ().insertRow (row_count , label , widget )
195
+
196
+ elif not widget and label :
197
+ label .setSizePolicy (QSizePolicy .Maximum , QSizePolicy .Preferred )
198
+ self .scrollAreaWidgetContents .layout ().insertRow (row_count , label )
188
199
189
200
row_count += 1
190
201
@@ -203,6 +214,10 @@ def __init__(self, clip_id, effect_name, effect_params):
203
214
self .cancel_clip_processing = False
204
215
self .effect = None
205
216
217
+ def link_activated (self , widget , param , value ):
218
+ """Link activated"""
219
+ webbrowser .open (value , new = 1 )
220
+
206
221
def spinner_value_changed (self , widget , param , value ):
207
222
"""Spinner value change callback"""
208
223
self .context [param ["setting" ]] = value
@@ -256,7 +271,7 @@ def rect_select_clicked(self, widget, param):
256
271
bottomRight = win .videoPreview .regionBottomRightHandle
257
272
viewPortSize = win .viewport_rect
258
273
curr_frame_size = win .videoPreview .curr_frame_size
259
-
274
+
260
275
x1 = topLeft .x () / curr_frame_size .width ()
261
276
y1 = topLeft .y () / curr_frame_size .height ()
262
277
x2 = bottomRight .x () / curr_frame_size .width ()
0 commit comments