Browse Source

Avoid 'KeyError' exception during options reset

Use the TwoWayOrderedDict.get(...) method in order to update
the language combobox and return 'en_US' as the default language
in case the given key value is not in the LOCALE_NAMES dict.

Fixes: c4b012d2c8
Related to: #244
doc-issue-template
MrS0m30n3 7 years ago
parent
commit
45009953d1
1 changed files with 1 additions and 1 deletions
  1. 2
      youtube_dl_gui/optionsframe.py

2
youtube_dl_gui/optionsframe.py

@ -429,7 +429,7 @@ class GeneralTab(TabPanel):
self.sudo_textctrl.Enable(self.shutdown_checkbox.GetValue())
def load_options(self):
self.language_combobox.SetValue(self.LOCALE_NAMES[self.opt_manager.options["locale_name"]])
self.language_combobox.SetValue(self.LOCALE_NAMES.get(self.opt_manager.options["locale_name"], "en_US"))
self.filename_format_combobox.SetValue(OUTPUT_FORMATS[self.opt_manager.options["output_format"]])
self.filename_custom_format.SetValue(self.opt_manager.options["output_template"])
self.filename_ascii_checkbox.SetValue(self.opt_manager.options["restrict_filenames"])

Loading…
Cancel
Save