@@ -72,12 +72,6 @@ def __init__(self, file=None, preview=False):
72
72
# Track metrics
73
73
track_metric_screen ("cutting-screen" )
74
74
75
- # If preview, hide cutting controls
76
- if preview :
77
- self .lblInstructions .setVisible (False )
78
- self .widgetControls .setVisible (False )
79
- self .setWindowTitle (_ ("Preview" ))
80
-
81
75
self .start_frame = 1
82
76
self .start_image = None
83
77
self .end_frame = 1
@@ -96,6 +90,15 @@ def __init__(self, file=None, preview=False):
96
90
self .channels = int (file .data ['channels' ])
97
91
self .channel_layout = int (file .data ['channel_layout' ])
98
92
93
+ # If preview, hide cutting controls
94
+ if preview :
95
+ self .lblInstructions .setVisible (False )
96
+ self .widgetControls .setVisible (False )
97
+ self .setWindowTitle (_ ("Preview" ))
98
+ self .start_frame = round (file .data .get ("start" , 0 ) * self .fps ) + 1
99
+ self .end_frame = round (file .data .get ("end" , 0 ) * self .fps )
100
+ self .video_length = (self .end_frame - self .start_frame ) + 1
101
+
99
102
# Open video file with Reader
100
103
log .info (self .file_path )
101
104
@@ -162,14 +165,9 @@ def __init__(self, file=None, preview=False):
162
165
self .sliderVideo .setSingleStep (1 )
163
166
self .sliderVideo .setPageStep (24 )
164
167
165
- # Determine if a start or end attribute is in this file
166
- start_frame = 1
167
- if 'start' in self .file .data :
168
- start_frame = (float (self .file .data ['start' ]) * self .fps ) + 1
169
-
170
168
# Display start frame (and then the previous frame)
171
- QTimer .singleShot (500 , functools .partial (self .sliderVideo .setValue , start_frame + 1 ))
172
- QTimer .singleShot (600 , functools .partial (self .sliderVideo .setValue , start_frame ))
169
+ QTimer .singleShot (500 , functools .partial (self .sliderVideo .setValue , self . start_frame + 1 ))
170
+ QTimer .singleShot (600 , functools .partial (self .sliderVideo .setValue , self . start_frame ))
173
171
174
172
# Connect signals
175
173
self .actionPlay .triggered .connect (self .actionPlay_Triggered )
@@ -343,8 +341,8 @@ def btnAddClip_clicked(self):
343
341
self .file .id = None
344
342
self .file .key = None
345
343
self .file .type = 'insert'
346
- self .file .data ['start' ] = (self .start_frame - 1 ) / self .fps
347
- self .file .data ['end' ] = ( self .end_frame - 1 ) / self .fps
344
+ self .file .data ['start' ] = (self .start_frame - 1 ) / self .fps
345
+ self .file .data ['end' ] = self .end_frame / self .fps
348
346
if self .txtName .text ():
349
347
self .file .data ['name' ] = self .txtName .text ()
350
348
self .file .save ()
0 commit comments