summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/stitch_group.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitch_plan/stitch_group.py')
-rw-r--r--lib/stitch_plan/stitch_group.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/stitch_plan/stitch_group.py b/lib/stitch_plan/stitch_group.py
index c85fc5f5..0730101c 100644
--- a/lib/stitch_plan/stitch_group.py
+++ b/lib/stitch_plan/stitch_group.py
@@ -17,8 +17,17 @@ class StitchGroup:
between them by the stitch plan generation code.
"""
- def __init__(self, color=None, stitches=None, trim_after=False, stop_after=False,
- lock_stitches=(None, None), force_lock_stitches=False, tags=None):
+ def __init__(
+ self,
+ color=None,
+ stitches=None,
+ min_jump_stitch_length=False,
+ trim_after=False,
+ stop_after=False,
+ lock_stitches=(None, None),
+ force_lock_stitches=False,
+ tags=None
+ ):
# DANGER: if you add new attributes, you MUST also set their default
# values in __new__() below. Otherwise, cached stitch plans can be
# loaded and create objects without those properties defined, because
@@ -29,6 +38,7 @@ class StitchGroup:
self.stop_after = stop_after
self.lock_stitches = lock_stitches
self.force_lock_stitches = force_lock_stitches
+ self.min_jump_stitch_length = min_jump_stitch_length
self.stitches = []
if stitches:
@@ -55,9 +65,13 @@ class StitchGroup:
raise TypeError("StitchGroup can only be added to another StitchGroup")
def __len__(self):
- # This method allows `len(patch)` and `if patch:
+ # This method allows `len(stitch_group)` and `if stitch_group:
return len(self.stitches)
+ def set_minimum_stitch_length(self, min_stitch_length):
+ for stitch in self.stitches:
+ stitch.min_stitch_length = min_stitch_length
+
def add_stitches(self, stitches, tags=None):
for stitch in stitches:
self.add_stitch(stitch, tags=tags)
@@ -66,7 +80,6 @@ class StitchGroup:
if not isinstance(stitch, Stitch):
# probably a Point
stitch = Stitch(stitch, tags=tags)
-
self.stitches.append(stitch)
def reverse(self):