summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/fill_stitch.py11
-rw-r--r--lib/extensions/params.py5
-rw-r--r--lib/extensions/stitch_plan_preview.py2
-rw-r--r--lib/gui/satin_multicolor/__init__.py1
-rw-r--r--lib/gui/satin_multicolor/color_panel.py2
-rw-r--r--lib/gui/satin_multicolor/colorize_panel.py7
-rw-r--r--lib/gui/satin_multicolor/main_panel.py5
-rw-r--r--lib/gui/tartan/__init__.py1
-rw-r--r--lib/gui/tartan/customize_panel.py143
-rw-r--r--lib/gui/tartan/main_panel.py3
-rw-r--r--lib/gui/tartan/stripe_panel.py52
-rw-r--r--lib/stitches/linear_gradient_fill.py26
-rw-r--r--lib/tartan/palette.py16
13 files changed, 151 insertions, 123 deletions
diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py
index 7d96fd14..7b0ced92 100644
--- a/lib/elements/fill_stitch.py
+++ b/lib/elements/fill_stitch.py
@@ -727,14 +727,14 @@ class FillStitch(EmbroideryElement):
@property
@cache
def shape(self):
- # avoid FloatingPointError while keeping a decent precision necessary for clamp path
- shape = set_precision(self._get_clipped_path(), 0.0000000001)
+ shape = self._get_clipped_path()
if shape.is_valid:
- return ensure_multi_polygon(shape, 3)
+ # set_precision to avoid FloatingPointErrors
+ return ensure_multi_polygon(set_precision(shape, 0.0000000001), 3)
shape = make_valid(shape)
- return ensure_multi_polygon(shape, 3)
+ return ensure_multi_polygon(set_precision(shape, 0.00000000001), 3)
def _get_clipped_path(self):
if self.node.clip is None:
@@ -964,7 +964,8 @@ class FillStitch(EmbroideryElement):
def do_underlay(self, shape, starting_point):
color = self.color
if self.gradient is not None and self.fill_method == 'linear_gradient_fill':
- color = [style['stop-color'] for style in self.gradient.stop_styles][0]
+ color = self.gradient.stops[0].get_computed_style('stop-color')
+
stitch_groups = []
for i in range(len(self.fill_underlay_angle)):
underlay = StitchGroup(
diff --git a/lib/extensions/params.py b/lib/extensions/params.py
index 77aab310..194f0cfd 100644
--- a/lib/extensions/params.py
+++ b/lib/extensions/params.py
@@ -449,8 +449,9 @@ class ParamsTab(ScrolledPanel):
box.Add(self.settings_grid, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
- self.SetSizer(box)
self.update_choice_widgets()
+ self.SetSizer(box)
+ self.SetMinSize((box.CalcMin()[0], 200))
self.Layout()
@@ -638,7 +639,7 @@ class SettingsPanel(wx.Panel):
# 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.SetSizeHints(600, 400)
self.Layout()
# end wxGlade
diff --git a/lib/extensions/stitch_plan_preview.py b/lib/extensions/stitch_plan_preview.py
index 42fa37d4..983435bb 100644
--- a/lib/extensions/stitch_plan_preview.py
+++ b/lib/extensions/stitch_plan_preview.py
@@ -55,7 +55,7 @@ class StitchPlanPreview(InkstitchExtension):
stitch_plan = stitch_groups_to_stitch_plan(stitch_groups, collapse_len=collapse_len, min_stitch_len=min_stitch_len)
layer = render_stitch_plan(svg, stitch_plan, realistic, visual_commands, render_jumps=self.options.render_jumps)
- if self.options.ignore_layer:
+ if self.options.ignore_layer and not self.options.mode[-1].isdigit():
add_layer_commands(layer, ["ignore_layer"])
layer = self.rasterize(svg, layer, raster_mult)
diff --git a/lib/gui/satin_multicolor/__init__.py b/lib/gui/satin_multicolor/__init__.py
index 84406f22..5dc39049 100644
--- a/lib/gui/satin_multicolor/__init__.py
+++ b/lib/gui/satin_multicolor/__init__.py
@@ -3,6 +3,7 @@
# Copyright (c) 2024 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+from .color_panel import ColorPanel
from .colorize_panel import ColorizePanel
from .help_panel import HelpPanel
from .main_panel import MultiColorSatinPanel
diff --git a/lib/gui/satin_multicolor/color_panel.py b/lib/gui/satin_multicolor/color_panel.py
index c44599c8..e4961064 100644
--- a/lib/gui/satin_multicolor/color_panel.py
+++ b/lib/gui/satin_multicolor/color_panel.py
@@ -1,6 +1,6 @@
# Authors: see git history
#
-# Copyright (c) 2023 Authors
+# Copyright (c) 2024 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
import wx
diff --git a/lib/gui/satin_multicolor/colorize_panel.py b/lib/gui/satin_multicolor/colorize_panel.py
index 3b595043..2dc10673 100644
--- a/lib/gui/satin_multicolor/colorize_panel.py
+++ b/lib/gui/satin_multicolor/colorize_panel.py
@@ -9,7 +9,7 @@ import wx
from wx.lib.scrolledpanel import ScrolledPanel
from ...i18n import _
-from .color_panel import ColorPanel
+from . import ColorPanel
class ColorizePanel(ScrolledPanel):
@@ -169,9 +169,8 @@ class ColorizePanel(ScrolledPanel):
self.Layout()
def _remove_color(self, event):
- sizer = event.GetEventObject().GetContainingSizer()
- sizer.Clear(True)
- self.color_sizer.Remove(sizer)
+ panel = event.GetEventObject().GetParent()
+ panel.Destroy()
self.FitInside()
self._update_colors()
diff --git a/lib/gui/satin_multicolor/main_panel.py b/lib/gui/satin_multicolor/main_panel.py
index e90ba855..197e197c 100644
--- a/lib/gui/satin_multicolor/main_panel.py
+++ b/lib/gui/satin_multicolor/main_panel.py
@@ -60,12 +60,11 @@ class MultiColorSatinPanel(wx.Panel):
self.notebook_sizer.Add(apply_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
- self.SetSizer(self.notebook_sizer)
-
self.colorize_panel.add_color(self.elements[0].color)
+ self.SetSizerAndFit(self.notebook_sizer)
+
self.Layout()
- self.SetMinSize(self.notebook_sizer.CalcMin())
def _hide_warning(self):
self.warning_panel.clear()
diff --git a/lib/gui/tartan/__init__.py b/lib/gui/tartan/__init__.py
index 176d5d1e..7ba13789 100644
--- a/lib/gui/tartan/__init__.py
+++ b/lib/gui/tartan/__init__.py
@@ -4,6 +4,7 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from .code_panel import CodePanel
+from .stripe_panel import StripePanel
from .customize_panel import CustomizePanel
from .embroidery_panel import EmbroideryPanel
from .help_panel import HelpPanel
diff --git a/lib/gui/tartan/customize_panel.py b/lib/gui/tartan/customize_panel.py
index a966bad1..cc2e372e 100644
--- a/lib/gui/tartan/customize_panel.py
+++ b/lib/gui/tartan/customize_panel.py
@@ -3,12 +3,11 @@
# Copyright (c) 2023 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-from math import floor
-
import wx
from wx.lib.scrolledpanel import ScrolledPanel
from ...i18n import _
+from . import StripePanel
class CustomizePanel(ScrolledPanel):
@@ -114,92 +113,67 @@ class CustomizePanel(ScrolledPanel):
self.add_stripe(False)
def add_stripe(self, warp=True, stripe=None, update=True):
- stripesizer = wx.BoxSizer(wx.HORIZONTAL)
-
- position = wx.Button(self, label='⁝', style=wx.BU_EXACTFIT)
- position.SetToolTip(_("Drag and drop to adjust position."))
- position.Bind(wx.EVT_LEFT_DOWN, self._move_stripe_start)
- position.Bind(wx.EVT_LEFT_UP, self._move_stripe_end)
-
- visibility = wx.CheckBox(self, style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
- visibility.SetToolTip(_("Checked: stitch this stripe | Minus: spacer for strokes only | Disabled: spacer for fill and stroke"))
- visibility.Set3StateValue(1)
- visibility.Bind(wx.EVT_CHECKBOX, self._update_stripes_event)
-
- # hidden label used for linked colors
- # there seems to be no native way to catch the old color setting
- colorinfo = wx.StaticText(self, label='black')
- colorinfo.Hide()
-
- colorpicker = wx.ColourPickerCtrl(self, colour=wx.Colour('black'))
- colorpicker.SetToolTip(_("Select stripe color"))
- colorpicker.Bind(wx.EVT_COLOURPICKER_CHANGED, self._update_color)
-
- stripe_width = wx.SpinCtrlDouble(self, min=0.0, max=500, initial=5, style=wx.SP_WRAP)
- stripe_width.SetDigits(2)
- stripe_width.SetToolTip(_("Set stripe width (mm)"))
- stripe_width.Bind(wx.EVT_SPINCTRLDOUBLE, self._update_stripes_event)
-
- remove_button = wx.Button(self, label='X')
- remove_button.SetToolTip(_("Remove stripe"))
- remove_button.Bind(wx.EVT_BUTTON, self._remove_stripe)
-
- stripesizer.Add(position, 0, wx.CENTER | wx.RIGHT | wx.TOP, 5)
- stripesizer.Add(visibility, 0, wx.CENTER | wx.RIGHT | wx.TOP, 5)
- stripesizer.Add(colorinfo, 0, wx.RIGHT | wx.TOP, 5)
- stripesizer.Add(colorpicker, 0, wx.RIGHT | wx.TOP, 5)
- stripesizer.Add(stripe_width, 1, wx.RIGHT | wx.TOP, 5)
- stripesizer.Add(remove_button, 0, wx.CENTER | wx.TOP, 5)
+ stripe_panel = StripePanel(self)
if stripe is not None:
- visibility.Set3StateValue(stripe['render'])
- colorinfo.SetLabel(wx.Colour(stripe['color']).GetAsString(wx.C2S_HTML_SYNTAX))
- colorpicker.SetColour(wx.Colour(stripe['color']))
- stripe_width.SetValue(stripe['width'])
+ stripe_panel.visibility.Set3StateValue(stripe['render'])
+ stripe_panel.colorinfo.SetLabel(wx.Colour(stripe['color']).GetAsString(wx.C2S_HTML_SYNTAX))
+ stripe_panel.colorpicker.SetColour(wx.Colour(stripe['color']))
+ stripe_panel.stripe_width.SetValue(stripe['width'])
+
if warp:
- self.warp_sizer.Add(stripesizer, 0, wx.EXPAND | wx.ALL, 5)
+ self.warp_sizer.Add(stripe_panel, 0, wx.EXPAND | wx.ALL, 5)
else:
- self.weft_sizer.Add(stripesizer, 0, wx.EXPAND | wx.ALL, 5)
+ self.weft_sizer.Add(stripe_panel, 0, wx.EXPAND | wx.ALL, 5)
+
if update:
self.panel.update_from_stripes()
- self.set_stripe_width_color(stripe_width)
- self.FitInside()
- def _move_stripe_start(self, event):
- self.mouse_position = wx.GetMousePosition()
+ self._hide_first_position_button()
+ self.set_stripe_width_color(stripe_panel.stripe_width)
+ self.FitInside()
- def _move_stripe_end(self, event):
+ def _move_stripe_up(self, event):
stripe = event.GetEventObject()
- sizer = stripe.GetContainingSizer()
- if self.warp_sizer.GetItem(sizer):
- main_sizer = self.warp_sizer
- else:
- main_sizer = self.weft_sizer
- for i, item in enumerate(main_sizer.GetChildren()):
- if item.GetSizer() == sizer:
+
+ main_sizer = None
+ i = 0
+ panel = stripe.GetParent()
+ for i, item in enumerate(self.warp_sizer.GetChildren()):
+ if item.GetWindow() == panel:
+ main_sizer = self.warp_sizer
index = i
- break
- position = wx.GetMousePosition()
- sizer_height = sizer.GetSize()[1] + 10
- move = floor((position[1] - self.mouse_position[1]) / sizer_height)
- index = min(len(main_sizer.Children) - 1, max(0, (index + move)))
- main_sizer.Detach(sizer)
- main_sizer.Insert(index, sizer, 0, wx.EXPAND | wx.ALL, 5)
+ if not main_sizer:
+ for i, item in enumerate(self.weft_sizer.GetChildren()):
+ if item.GetWindow() == panel:
+ main_sizer = self.weft_sizer
+ index = i
+
+ index = max(0, (index - 1))
+ if index == 0:
+ previous_first = main_sizer.GetChildren()[0].GetWindow()
+ previous_first.position.Show()
+
+ main_sizer.Detach(panel)
+ main_sizer.Insert(index, panel, 0, wx.EXPAND | wx.ALL, 5)
+ self._hide_first_position_button()
self.panel.update_from_stripes()
self.FitInside()
+ self.Layout()
def _remove_stripe(self, event):
- sizer = event.GetEventObject().GetContainingSizer()
- sizer.Clear(True)
- self.warp_sizer.Remove(sizer)
- try:
- self.weft_sizer.Remove(sizer)
- except RuntimeError:
- # we may have removed it already
- pass
+ panel = event.GetEventObject().GetParent()
+ panel.Destroy()
+ self._hide_first_position_button()
self.panel.update_from_stripes()
self.FitInside()
+ def _hide_first_position_button(self):
+ if len(self.warp_sizer.GetChildren()) > 0:
+ self.warp_sizer.GetChildren()[0].GetWindow().position.Show(False)
+ if len(self.weft_sizer.GetChildren()) > 0:
+ self.weft_sizer.GetChildren()[0].GetWindow().position.Show(False)
+
def on_change(self, attribute, event):
self.panel.settings[attribute] = event.EventObject.GetValue()
self.panel.update_preview()
@@ -217,11 +191,8 @@ class CustomizePanel(ScrolledPanel):
def update_stripe_width_colors(self):
for sizer in [self.warp_sizer, self.weft_sizer]:
for stripe_sizer in sizer.GetChildren():
- inner_sizer = stripe_sizer.GetSizer()
- for stripe_widget in inner_sizer:
- widget = stripe_widget.GetWindow()
- if isinstance(widget, wx.SpinCtrlDouble):
- self.set_stripe_width_color(widget)
+ stripe_panel = stripe_sizer.GetWindow()
+ self.set_stripe_width_color(stripe_panel.stripe_width)
def set_stripe_width_color(self, stripe_width_ctrl):
scale = self.scale.GetValue()
@@ -258,14 +229,11 @@ class CustomizePanel(ScrolledPanel):
def _update_color_picker(self, old_color, new_color, sizer):
for stripe_sizer in sizer.Children:
- stripe_info = stripe_sizer.GetSizer()
- for widget in stripe_info.GetChildren():
- widget = widget.GetWindow()
- if isinstance(widget, wx.ColourPickerCtrl):
- color = widget.GetColour()
- if color == old_color:
- widget.SetColour(new_color)
- widget.GetPrevSibling().SetLabel(new_color.GetAsString(wx.C2S_HTML_SYNTAX))
+ stripe_panel = stripe_sizer.GetWindow()
+ color = stripe_panel.colorpicker.GetColour()
+ if color == old_color:
+ stripe_panel.colorpicker.SetColour(new_color)
+ stripe_panel.colorinfo.SetLabel(new_color.GetAsString(wx.C2S_HTML_SYNTAX))
def update_symmetry(self, event=None):
symmetry = self.symmetry_checkbox.GetValue()
@@ -293,8 +261,5 @@ class CustomizePanel(ScrolledPanel):
def _hide_colorinfo(self):
for stripe_sizer in self.weft_sizer.Children:
- stripe_info = stripe_sizer.GetSizer()
- for stripe in stripe_info.GetChildren():
- widget = stripe.GetWindow()
- if isinstance(widget, wx.StaticText):
- widget.Hide()
+ stripe_panel = stripe_sizer.GetWindow()
+ stripe_panel.colorinfo.Hide()
diff --git a/lib/gui/tartan/main_panel.py b/lib/gui/tartan/main_panel.py
index 34015fb4..9df6a748 100644
--- a/lib/gui/tartan/main_panel.py
+++ b/lib/gui/tartan/main_panel.py
@@ -39,6 +39,7 @@ class TartanMainPanel(wx.Panel):
# preview
self.preview_renderer = PreviewRenderer(self.render_stitch_plan, self.on_stitch_plan_rendered)
+ # presets
self.presets_panel = PresetsPanel(self)
# warnings
self.warning_panel = WarningPanel(self)
@@ -73,7 +74,7 @@ class TartanMainPanel(wx.Panel):
self.notebook_sizer.Add(self.presets_panel, 0, wx.EXPAND | wx.ALL, 10)
self.notebook_sizer.Add(apply_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
- self.SetSizer(self.notebook_sizer)
+ self.SetSizerAndFit(self.notebook_sizer)
self.load_settings()
self.apply_settings()
diff --git a/lib/gui/tartan/stripe_panel.py b/lib/gui/tartan/stripe_panel.py
new file mode 100644
index 00000000..3188f56b
--- /dev/null
+++ b/lib/gui/tartan/stripe_panel.py
@@ -0,0 +1,52 @@
+# Authors: see git history
+#
+# Copyright (c) 2023 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+import wx
+
+from ...i18n import _
+
+
+class StripePanel(wx.Panel):
+ def __init__(self, parent, *args, **kwargs):
+ self.panel = parent
+ wx.Panel.__init__(self, parent, wx.ID_ANY, *args, **kwargs)
+
+ stripesizer = wx.BoxSizer(wx.HORIZONTAL)
+
+ self.position = wx.Button(self, label='↑', style=wx.BU_EXACTFIT)
+ self.position.SetToolTip(_("Click to move color up."))
+ self.position.Bind(wx.EVT_BUTTON, self.panel._move_stripe_up)
+
+ self.visibility = wx.CheckBox(self, style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
+ self.visibility.SetToolTip(_("Checked: stitch this stripe | Minus: spacer for strokes only | Disabled: spacer for fill and stroke"))
+ self.visibility.Set3StateValue(1)
+ self.visibility.Bind(wx.EVT_CHECKBOX, self.panel._update_stripes_event)
+
+ # hidden label used for linked colors
+ # there seems to be no native way to catch the old color setting
+ self.colorinfo = wx.StaticText(self, label='black')
+ self.colorinfo.Hide()
+
+ self.colorpicker = wx.ColourPickerCtrl(self, colour=wx.Colour('black'))
+ self.colorpicker.SetToolTip(_("Select stripe color"))
+ self.colorpicker.Bind(wx.EVT_COLOURPICKER_CHANGED, self.panel._update_color)
+
+ self.stripe_width = wx.SpinCtrlDouble(self, min=0.0, max=500, initial=5, style=wx.SP_WRAP)
+ self.stripe_width.SetDigits(2)
+ self.stripe_width.SetToolTip(_("Set stripe width (mm)"))
+ self.stripe_width.Bind(wx.EVT_SPINCTRLDOUBLE, self.panel._update_stripes_event)
+
+ self.remove_button = wx.Button(self, label='X')
+ self.remove_button.SetToolTip(_("Remove stripe"))
+ self.remove_button.Bind(wx.EVT_BUTTON, self.panel._remove_stripe)
+
+ stripesizer.Add(self.position, 0, wx.RESERVE_SPACE_EVEN_IF_HIDDEN | wx.CENTER | wx.RIGHT | wx.TOP, 5)
+ stripesizer.Add(self.visibility, 0, wx.CENTER | wx.RIGHT | wx.TOP, 5)
+ stripesizer.Add(self.colorinfo, 0, wx.RIGHT | wx.TOP, 5)
+ stripesizer.Add(self.colorpicker, 0, wx.RIGHT | wx.TOP, 5)
+ stripesizer.Add(self.stripe_width, 1, wx.RIGHT | wx.TOP, 5)
+ stripesizer.Add(self.remove_button, 0, wx.CENTER | wx.TOP, 5)
+
+ self.SetSizer(stripesizer)
diff --git a/lib/stitches/linear_gradient_fill.py b/lib/stitches/linear_gradient_fill.py
index e72161ca..ea248d98 100644
--- a/lib/stitches/linear_gradient_fill.py
+++ b/lib/stitches/linear_gradient_fill.py
@@ -66,7 +66,17 @@ def _get_gradient_info(fill, bbox):
else:
fill.gradient.apply_transform()
offsets = fill.gradient.stop_offsets
- colors = [style['stop-color'] if float(style['stop-opacity']) > 0 else 'none' for style in fill.gradient.stop_styles]
+ # get stop colors
+ # it would be easier if we just used fill.gradient.stop_styles to collect them
+ # but inkex/tinycss fails on stop color styles when it is not in the style attribute, but in it's own stop-color attribute
+ colors = []
+ for stop in fill.gradient.stops:
+ color = stop.get_computed_style('stop-color')
+ opacity = stop.get_computed_style('stop-opacity')
+ if float(opacity) > 0:
+ colors.append(color)
+ else:
+ colors.append('none')
gradient_start, gradient_end = gradient_start_end(fill.node, fill.gradient)
angle = gradient_angle(fill.node, fill.gradient)
return angle, colors, offsets, Point(list(gradient_start)), Point(list(gradient_end))
@@ -167,6 +177,7 @@ def _get_color_lines(lines, colors, stop_color_line_indices):
c2_count = 0
c1_count = 0
+ max_count = 1000
current_line = 0
line_count_diff = floor((total_lines - sections**2) / 2)
@@ -181,7 +192,7 @@ def _get_color_lines(lines, colors, stop_color_line_indices):
rest = c1_count % c2_count
c1_count = ceil(c1_count / c2_count)
- current_line, line_count_diff, color1, color2, stop = _add_lines(
+ current_line, line_count_diff, color1, color2, max_count, stop = _add_lines(
current_line,
total_lines,
line_count_diff,
@@ -190,7 +201,8 @@ def _get_color_lines(lines, colors, stop_color_line_indices):
stop,
rest,
c1_count,
- c2_count
+ c2_count,
+ max_count
)
# mirror the first half of the color section to receive the full section
@@ -232,10 +244,11 @@ def _get_color_lines(lines, colors, stop_color_line_indices):
return color_lines, colors
-def _add_lines(current_line, total_lines, line_count_diff, color1, color2, stop, rest, c1_count, c2_count):
+def _add_lines(current_line, total_lines, line_count_diff, color1, color2, stop, rest, c1_count, c2_count, max_count):
for j in range(c2_count):
if stop:
break
+
if rest == 0 or j < rest:
count = c1_count
else:
@@ -243,6 +256,8 @@ def _add_lines(current_line, total_lines, line_count_diff, color1, color2, stop,
if line_count_diff > 0:
count += 1
line_count_diff -= 1
+ count = min(count, max_count)
+
for k in range(count):
color1.append(current_line)
current_line += 1
@@ -251,7 +266,8 @@ def _add_lines(current_line, total_lines, line_count_diff, color1, color2, stop,
break
color2.append(current_line)
current_line += 1
- return current_line, line_count_diff, color1, color2, stop
+ max_count = count
+ return current_line, line_count_diff, color1, color2, max_count, stop
def _get_stitch_groups(fill, shape, colors, color_lines, starting_point, ending_point):
diff --git a/lib/tartan/palette.py b/lib/tartan/palette.py
index 2e33fbc8..d945eb83 100644
--- a/lib/tartan/palette.py
+++ b/lib/tartan/palette.py
@@ -59,18 +59,10 @@ class Palette:
stripes = []
for stripe_sizer in outer_sizer.Children:
stripe = {'render': 1, 'color': '#000000', 'width': '5'}
- stripe_info = stripe_sizer.GetSizer()
- for color in stripe_info.GetChildren():
- widget = color.GetWindow()
- if isinstance(widget, wx.CheckBox):
- # in embroidery it is ok to have gaps between the stripes
- stripe['render'] = widget.Get3StateValue()
- elif isinstance(widget, wx.ColourPickerCtrl):
- stripe['color'] = widget.GetColour().GetAsString(wx.C2S_HTML_SYNTAX)
- elif isinstance(widget, wx.SpinCtrlDouble):
- stripe['width'] = widget.GetValue()
- elif isinstance(widget, wx.Button) or isinstance(widget, wx.StaticText):
- continue
+ stripe_panel = stripe_sizer.GetWindow()
+ stripe['render'] = stripe_panel.visibility.Get3StateValue()
+ stripe['color'] = stripe_panel.colorpicker.GetColour().GetAsString(wx.C2S_HTML_SYNTAX)
+ stripe['width'] = stripe_panel.stripe_width.GetValue()
stripes.append(stripe)
self.palette_stripes[i] = stripes
if self.equal_warp_weft: