Browse Source

wxGUI/preferences.py: fix loading default user settings (#2041)

wx.ComboBox, wx.TextCtrl widgets require string value
for setting value via SetValue() method, instead of
integer.
Tomas Zigo 3 years ago
parent
commit
bc75077672
1 changed files with 5 additions and 1 deletions
  1. 5 1
      gui/wxpython/gui_core/preferences.py

+ 5 - 1
gui/wxpython/gui_core/preferences.py

@@ -155,7 +155,11 @@ class PreferencesBaseDialog(wx.Dialog):
                 )
             win = self.FindWindowById(self.winId[gks])
 
-            if win.GetName() in ("GetValue", "IsChecked"):
+            if win.GetName() == "IsChecked":
+                value = win.SetValue(value)
+            elif win.GetName() == "GetValue":
+                if isinstance(win, (wx.ComboBox, wx.TextCtrl)):
+                    value = str(value)
                 value = win.SetValue(value)
             elif win.GetName() == "GetSelection":
                 value = win.SetSelection(value)