diff options
Diffstat (limited to 'lib/extensions/params.py')
| -rw-r--r-- | lib/extensions/params.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 71d8339f..acd96d5b 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -153,7 +153,11 @@ class ParamsTab(ScrolledPanel): for name, input in self.param_inputs.items(): if input in self.changed_inputs and input != self.toggle_checkbox: - values[name] = input.GetValue() + try: + values[name] = input.GetValue() + except AttributeError: + # dropdown + values[name] = input.GetSelection() return values @@ -183,7 +187,10 @@ class ParamsTab(ScrolledPanel): for name, value in preset_data.items(): if name in self.param_inputs: - self.param_inputs[name].SetValue(value) + try: + self.param_inputs[name].SetValue(value) + except AttributeError: + self.param_inputs[name].SetSelection(int(value)) self.changed_inputs.add(self.param_inputs[name]) self.update_toggle_state() @@ -271,6 +278,10 @@ class ParamsTab(ScrolledPanel): input.SetValue(param.values[0]) input.Bind(wx.EVT_CHECKBOX, self.changed) + elif param.type == 'dropdown': + input = wx.Choice(self, wx.ID_ANY, choices=param.options) + input.SetSelection(int(param.values[0])) + input.Bind(wx.EVT_CHOICE, self.changed) elif len(param.values) > 1: input = wx.ComboBox(self, wx.ID_ANY, choices=sorted(str(value) for value in param.values), style=wx.CB_DROPDOWN) input.Bind(wx.EVT_COMBOBOX, self.changed) @@ -449,6 +460,13 @@ class SettingsFrame(wx.Frame): sizer_1.Add(sizer_3, 0, wx.ALIGN_RIGHT, 0) self.SetSizer(sizer_1) sizer_1.Fit(self) + + # prevent the param dialog to become smaller than 500*400 + # otherwise the scrollbar jumps to the side and produces a + # deprecation warning in wxpythons scrolledpanel.py line 225 - + # which is expecting an integer, but uses previously a division + self.SetSizeHints(500, 400) + self.Layout() # end wxGlade |
