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
master
MrS0m30n3 2017-12-10 18:23:53 +02:00
parent 7501118fcb
commit 45009953d1
1 changed files with 1 additions and 1 deletions

View File

@ -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"])