Skip to content

Commit

Permalink
Fix UI issue when an encoder is missing
Browse files Browse the repository at this point in the history
When an encoder is missing, we need to remove it from the local list in
addition to the UI model.

Closes lp:1926867, thanks JJ.
  • Loading branch information
Gautier Portet committed May 3, 2021
1 parent fd2c799 commit c7ebc88
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions soundconverter/interface/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
# ALL_COLUMNS = VISIBLE_COLUMNS + ['META']


encoders = (
encoders = [
('audio/x-vorbis', 'vorbisenc'),
('audio/mpeg', 'lamemp3enc'),
('audio/x-flac', 'flacenc'),
('audio/x-wav', 'wavenc'),
('audio/x-m4a', 'fdkaacenc,faac,avenc_aac'),
('audio/ogg; codecs=opus', 'opusenc'),
) # must be in same order as the output_mime_type GtkComboBox
] # must be in same order as the output_mime_type GtkComboBox


def idle(func):
Expand Down Expand Up @@ -610,6 +610,7 @@ def set_widget_initial_values(self):
)

i = 0
to_remove = []
model = self.output_mime_type.get_model()
for mime, encoder_name in encoders:
# valid default output?
Expand All @@ -625,7 +626,11 @@ def set_widget_initial_values(self):
'{} {} is not supported, a gstreamer plugins package '
'is possibly missing.'.format(mime, encoder_name)
)
del model[i]
to_remove.append(i)

for i in to_remove:
del model[i]
del encoders[i]

for i, mime in enumerate(self.present_mime_types):
if current_mime_type == mime:
Expand Down

0 comments on commit c7ebc88

Please sign in to comment.