Fixed an issue with restoring settings.
This commit is contained in:
parent
f06d1b7691
commit
35c5f68eea
1 changed files with 9 additions and 4 deletions
13
main.py
13
main.py
|
|
@ -998,7 +998,7 @@ class MainWindow(QtGui.QWidget):
|
||||||
for val in setting.values:
|
for val in setting.values:
|
||||||
combo.addItem(val)
|
combo.addItem(val)
|
||||||
|
|
||||||
default_index = combo.findData(setting.default_value)
|
default_index = combo.findText(setting.default_value)
|
||||||
if default_index != -1:
|
if default_index != -1:
|
||||||
combo.setCurrentIndex(default_index)
|
combo.setCurrentIndex(default_index)
|
||||||
|
|
||||||
|
|
@ -1055,10 +1055,9 @@ class MainWindow(QtGui.QWidget):
|
||||||
json_str = f.read()
|
json_str = f.read()
|
||||||
try:
|
try:
|
||||||
self.load_from_json(json_str)
|
self.load_from_json(json_str)
|
||||||
except ValueError: #Json file is invalid
|
except ValueError as e: #Json file is invalid
|
||||||
log( 'Warning: Json file invalid.')
|
log( 'Warning: Json file invalid.')
|
||||||
|
print e
|
||||||
|
|
||||||
self.ex_button.setEnabled(self.requiredSettingsFilled())
|
self.ex_button.setEnabled(self.requiredSettingsFilled())
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1079,6 +1078,12 @@ class MainWindow(QtGui.QWidget):
|
||||||
if setting.type == 'check':
|
if setting.type == 'check':
|
||||||
setting_field.setChecked(new_dic[item])
|
setting_field.setChecked(new_dic[item])
|
||||||
setting.value = new_dic[item]
|
setting.value = new_dic[item]
|
||||||
|
if setting.type == 'list':
|
||||||
|
val_str = self.convert_val_to_str(new_dic[item])
|
||||||
|
index = setting_field.findText(val_str)
|
||||||
|
if index != -1:
|
||||||
|
setting_field.setCurrentIndex(index)
|
||||||
|
setting.value = val_str
|
||||||
if isinstance(new_dic[item], dict):
|
if isinstance(new_dic[item], dict):
|
||||||
stack.append((item,new_dic[item]))
|
stack.append((item,new_dic[item]))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue