Explorar o código

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 %!s(int64=3) %!d(string=hai) anos
pai
achega
bc75077672
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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)