From 0ab7223980d849dd732cb9572644339d5c2a6228 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 27 Jul 2018 21:10:02 -0400 Subject: add E stitch for satin columns --- lib/elements/satin_column.py | 37 +++++++++++++++++++++++++++++++--- messages.po | 48 ++++++++++++++++++++++++-------------------- 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 2ceb38de..78275745 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -17,6 +17,12 @@ 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") @@ -28,7 +34,7 @@ class SatinColumn(EmbroideryElement): 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'), 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 @@ -76,7 +82,7 @@ class SatinColumn(EmbroideryElement): 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 (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 +394,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 +439,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 diff --git a/messages.po b/messages.po index 19400443..aba18ad9 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-07-25 21:18-0400\n" +"POT-Creation-Date: 2018-07-27 21:10-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -100,87 +100,91 @@ msgstr "" msgid "Custom satin column" msgstr "" -#: lib/elements/satin_column.py:25 lib/elements/stroke.py:35 +#: lib/elements/satin_column.py:22 +msgid "\"E\" stitch" +msgstr "" + +#: lib/elements/satin_column.py:31 lib/elements/stroke.py:35 msgid "Zig-zag spacing (peak-to-peak)" msgstr "" -#: lib/elements/satin_column.py:31 +#: lib/elements/satin_column.py:37 msgid "Pull compensation" msgstr "" -#: lib/elements/satin_column.py:39 +#: lib/elements/satin_column.py:45 msgid "Contour underlay" msgstr "" -#: lib/elements/satin_column.py:39 lib/elements/satin_column.py:46 -#: lib/elements/satin_column.py:51 +#: lib/elements/satin_column.py:45 lib/elements/satin_column.py:52 +#: lib/elements/satin_column.py:57 msgid "Contour Underlay" msgstr "" -#: lib/elements/satin_column.py:46 lib/elements/satin_column.py:64 +#: lib/elements/satin_column.py:52 lib/elements/satin_column.py:70 msgid "Stitch length" msgstr "" -#: lib/elements/satin_column.py:51 +#: lib/elements/satin_column.py:57 msgid "Contour underlay inset amount" msgstr "" -#: lib/elements/satin_column.py:57 +#: lib/elements/satin_column.py:63 msgid "Center-walk underlay" msgstr "" -#: lib/elements/satin_column.py:57 lib/elements/satin_column.py:64 +#: lib/elements/satin_column.py:63 lib/elements/satin_column.py:70 msgid "Center-Walk Underlay" msgstr "" -#: lib/elements/satin_column.py:69 +#: lib/elements/satin_column.py:75 msgid "Zig-zag underlay" msgstr "" -#: lib/elements/satin_column.py:69 lib/elements/satin_column.py:74 -#: lib/elements/satin_column.py:79 +#: lib/elements/satin_column.py:75 lib/elements/satin_column.py:80 +#: lib/elements/satin_column.py:85 msgid "Zig-zag Underlay" msgstr "" -#: lib/elements/satin_column.py:74 +#: lib/elements/satin_column.py:80 msgid "Zig-Zag spacing (peak-to-peak)" msgstr "" -#: lib/elements/satin_column.py:79 +#: lib/elements/satin_column.py:85 msgid "Inset amount (default: half of contour underlay inset)" msgstr "" -#: lib/elements/satin_column.py:112 +#: lib/elements/satin_column.py:118 #, python-format msgid "satin column: %(id)s: at least two subpaths required (%(num)d found)" msgstr "" -#: lib/elements/satin_column.py:138 +#: lib/elements/satin_column.py:144 msgid "" "One or more rails crosses itself, and this is not allowed. Please split " "into multiple satin columns." msgstr "" -#: lib/elements/satin_column.py:145 +#: lib/elements/satin_column.py:151 msgid "satin column: One or more of the rungs doesn't intersect both rails." msgstr "" -#: lib/elements/satin_column.py:145 lib/elements/satin_column.py:147 +#: lib/elements/satin_column.py:151 lib/elements/satin_column.py:153 msgid "Each rail should intersect both rungs once." msgstr "" -#: lib/elements/satin_column.py:147 +#: lib/elements/satin_column.py:153 msgid "" "satin column: One or more of the rungs intersects the rails more than " "once." msgstr "" -#: lib/elements/satin_column.py:188 +#: lib/elements/satin_column.py:194 #, python-format msgid "satin column: object %s has a fill (but should not)" msgstr "" -#: lib/elements/satin_column.py:192 +#: lib/elements/satin_column.py:198 #, python-format msgid "" "satin column: object %(id)s has two paths with an unequal number of " -- cgit v1.2.3