summaryrefslogtreecommitdiff
path: root/lib/extensions/params.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extensions/params.py')
-rw-r--r--lib/extensions/params.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py
index 87b9c3bf..10cc6e3c 100644
--- a/lib/extensions/params.py
+++ b/lib/extensions/params.py
@@ -14,7 +14,7 @@ from itertools import groupby
import wx
from wx.lib.scrolledpanel import ScrolledPanel
-from ..commands import is_command
+from ..commands import is_command, is_command_symbol
from ..elements import (AutoFill, Clone, EmbroideryElement, Fill, Polyline,
SatinColumn, Stroke)
from ..elements.clone import is_clone
@@ -158,7 +158,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
@@ -188,7 +192,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()
@@ -276,6 +283,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)
@@ -454,6 +465,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
@@ -471,7 +489,7 @@ class Params(InkstitchExtension):
element = EmbroideryElement(node)
classes = []
- if not is_command(node):
+ if not is_command(node) and not is_command_symbol(node):
if node.tag == SVG_POLYLINE_TAG:
classes.append(Polyline)
elif is_clone(node):