diff options
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
| -rw-r--r-- | lib/stitch_plan/stitch_plan.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index b621ef07..ac6b3b8d 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -169,6 +169,12 @@ class ColorBlock(object): def __repr__(self): return "ColorBlock(%s, %s)" % (self.color, self.stitches) + def __getitem__(self, item): + return self.stitches[item] + + def __delitem__(self, item): + del self.stitches[item] + def has_color(self): return self._color is not None @@ -210,6 +216,20 @@ class ColorBlock(object): else: return False + @property + def trim_after(self): + # If there's a STOP, it will be at the end. We still want to return + # True. + for stitch in reversed(self.stitches): + if stitch.stop or stitch.jump: + continue + elif stitch.trim: + return True + else: + break + + return False + def filter_duplicate_stitches(self): if not self.stitches: return |
