summaryrefslogtreecommitdiff
path: root/lib/elements/satin_column.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements/satin_column.py')
-rw-r--r--lib/elements/satin_column.py71
1 files changed, 65 insertions, 6 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index 2ceb38de..834509fd 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -17,18 +17,34 @@ class SatinColumn(EmbroideryElement):
def satin_column(self):
return self.get_boolean_param("satin_column")
+ # I18N: "E" stitch is so named because it looks like the letter E.
+ @property
+ @param('e_stitch', _('"E" stitch'), type='boolean', default='false')
+ def e_stitch(self):
+ return self.get_boolean_param("e_stitch")
+
@property
def color(self):
return self.get_style("stroke")
@property
- @param('zigzag_spacing_mm', _('Zig-zag spacing (peak-to-peak)'), unit='mm', type='float', default=0.4)
+ @param('zigzag_spacing_mm',
+ _('Zig-zag spacing (peak-to-peak)'),
+ tooltip=_('Peak-to-peak distance between zig-zags.'),
+ unit='mm',
+ type='float',
+ default=0.4)
def zigzag_spacing(self):
# peak-to-peak distance between zigzags
return max(self.get_float_param("zigzag_spacing_mm", 0.4), 0.01)
@property
- @param('pull_compensation_mm', _('Pull compensation'), unit='mm', type='float')
+ @param('pull_compensation_mm',
+ _('Pull compensation'),
+ tooltip=_('Satin stitches pull the fabric together, resulting in a column narrower than you draw in Inkscape. This setting expands each pair of needle penetrations outward from the center of the satin column.'),
+ unit='mm',
+ type='float',
+ default=0)
def pull_compensation(self):
# In satin stitch, the stitches have a tendency to pull together and
# narrow the entire column. We can compensate for this by stitching
@@ -48,7 +64,13 @@ class SatinColumn(EmbroideryElement):
return max(self.get_float_param("contour_underlay_stitch_length_mm", 1.5), 0.01)
@property
- @param('contour_underlay_inset_mm', _('Contour underlay inset amount'), unit='mm', group=_('Contour Underlay'), type='float', default=0.4)
+ @param('contour_underlay_inset_mm',
+ _('Contour underlay inset amount'),
+ tooltip=_('Shrink the outline, to prevent the underlay from showing around the outside of the satin column.'),
+ unit='mm',
+ group=_('Contour Underlay'),
+ type='float',
+ default=0.4)
def contour_underlay_inset(self):
# how far inside the edge of the column to stitch the underlay
return self.get_float_param("contour_underlay_inset_mm", 0.4)
@@ -71,12 +93,24 @@ class SatinColumn(EmbroideryElement):
return self.get_boolean_param("zigzag_underlay")
@property
- @param('zigzag_underlay_spacing_mm', _('Zig-Zag spacing (peak-to-peak)'), unit='mm', group=_('Zig-zag Underlay'), type='float', default=3)
+ @param('zigzag_underlay_spacing_mm',
+ _('Zig-Zag spacing (peak-to-peak)'),
+ tooltip=_('Distance between peaks of the zig-zags.'),
+ unit='mm',
+ group=_('Zig-zag Underlay'),
+ type='float',
+ default=3)
def zigzag_underlay_spacing(self):
return max(self.get_float_param("zigzag_underlay_spacing_mm", 3), 0.01)
@property
- @param('zigzag_underlay_inset_mm', _('Inset amount (default: half of contour underlay inset)'), unit='mm', group=_('Zig-zag Underlay'), type='float')
+ @param('zigzag_underlay_inset_mm',
+ _('Inset amount'),
+ tooltip=_('default: half of contour underlay inset'),
+ unit='mm',
+ group=_('Zig-zag Underlay'),
+ type='float',
+ default="")
def zigzag_underlay_inset(self):
# how far in from the edge of the satin the points in the zigzags
# should be
@@ -388,6 +422,28 @@ class SatinColumn(EmbroideryElement):
return patch
+ def do_e_stitch(self):
+ # e stitch: do a pattern that looks like the letter "E". It looks like
+ # this:
+ #
+ # _|_|_|_|_|_|_|_|_|_|_|_|
+
+ # print >> dbg, "satin", self.zigzag_spacing, self.pull_compensation
+
+ patch = Patch(color=self.color)
+
+ sides = self.walk_paths(self.zigzag_spacing, self.pull_compensation)
+
+ # "left" and "right" here are kind of arbitrary designations meaning
+ # a point from the first and second rail repectively
+ for left, right in izip(*sides):
+ patch.add_stitch(left)
+ patch.add_stitch(right)
+ patch.add_stitch(left)
+
+ return patch
+
+
def to_patches(self, last_patch):
# Stitch a variable-width satin column, zig-zagging between two paths.
@@ -411,6 +467,9 @@ class SatinColumn(EmbroideryElement):
# zigzags sit on the contour walk underlay like rail ties on rails.
patches.append(self.do_zigzag_underlay())
- patches.append(self.do_satin())
+ if self.e_stitch:
+ patches.append(self.do_e_stitch())
+ else:
+ patches.append(self.do_satin())
return patches