@@ -227,21 +227,15 @@ def __init__(self):
227
227
self .profile_names .sort ()
228
228
229
229
# Loop through sorted profiles
230
- box_index = 0
231
230
self .selected_profile_index = 0
232
- for profile_name in self .profile_names :
233
-
231
+ for box_index , profile_name in enumerate (self .profile_names ):
234
232
# Add to dropdown
235
233
self .cboProfile .addItem (self .getProfileName (self .getProfilePath (profile_name )), self .getProfilePath (profile_name ))
236
234
237
235
# Set default (if it matches the project)
238
236
if get_app ().project .get (['profile' ]) in profile_name :
239
237
self .selected_profile_index = box_index
240
238
241
- # increment item counter
242
- box_index += 1
243
-
244
-
245
239
# ********* Simple Project Type **********
246
240
# load the simple project type dropdown
247
241
presets = []
@@ -259,14 +253,12 @@ def __init__(self):
259
253
log .error ("Failed to parse file '%s' as a preset: %s" % (preset_path , e ))
260
254
261
255
# Exclude duplicates
262
- type_index = 0
263
256
selected_type = 0
264
257
presets = list (set (presets ))
265
- for item in sorted (presets ):
258
+ for type_index , item in enumerate ( sorted (presets ) ):
266
259
self .cboSimpleProjectType .addItem (item , item )
267
260
if item == _ ("All Formats" ):
268
261
selected_type = type_index
269
- type_index += 1
270
262
271
263
# Always select 'All Formats' option
272
264
self .cboSimpleProjectType .setCurrentIndex (selected_type )
@@ -559,12 +551,10 @@ def cboSimpleTarget_index_changed(self, widget, index):
559
551
560
552
self .txtAudioCodec .setText (audio_codec_name )
561
553
562
- layout_index = 0
563
- for layout in self .channel_layout_choices :
554
+ for layout_index , layout in enumerate (self .channel_layout_choices ):
564
555
if layout == int (c [0 ].childNodes [0 ].data ):
565
556
self .cboChannelLayout .setCurrentIndex (layout_index )
566
557
break
567
- layout_index += 1
568
558
569
559
# Free up DOM memory
570
560
xmldoc .unlink ()
@@ -606,17 +596,13 @@ def cboSimpleVideoProfile_index_changed(self, widget, index):
606
596
def populateAllProfiles (self , selected_profile_path ):
607
597
"""Populate the full list of profiles"""
608
598
# Look for matching profile in advanced options
609
- profile_index = 0
610
- for profile_name in self .profile_names :
599
+ for profile_index , profile_name in enumerate (self .profile_names ):
611
600
# Check for matching profile
612
601
if self .getProfilePath (profile_name ) == selected_profile_path :
613
602
# Matched!
614
603
self .cboProfile .setCurrentIndex (profile_index )
615
604
break
616
605
617
- # increment index
618
- profile_index += 1
619
-
620
606
def cboSimpleQuality_index_changed (self , widget , index ):
621
607
selected_quality = widget .itemData (index )
622
608
log .info (selected_quality )
@@ -797,7 +783,7 @@ def accept(self):
797
783
"video_bitrate" : int (self .convert_to_bytes (self .txtVideoBitRate .text ())),
798
784
"start_frame" : self .txtStartFrame .value (),
799
785
"end_frame" : self .txtEndFrame .value (),
800
- "interlace" : (( interlacedIndex == 1 ) or ( interlacedIndex == 2 )) ,
786
+ "interlace" : interlacedIndex in [ 1 , 2 ] ,
801
787
"topfirst" : interlacedIndex == 1
802
788
}
803
789
0 commit comments