summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stitch_plan/color_block.py8
-rw-r--r--lib/stitch_plan/stitch_plan.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/stitch_plan/color_block.py b/lib/stitch_plan/color_block.py
index 3cec826d..75b72a3b 100644
--- a/lib/stitch_plan/color_block.py
+++ b/lib/stitch_plan/color_block.py
@@ -74,6 +74,12 @@ class ColorBlock(object):
return length
@property
+ def num_stops(self):
+ """Number of stops in this color block."""
+
+ return sum(1 for stitch in self if stitch.stop)
+
+ @property
def num_trims(self):
"""Number of trims in this color block."""
@@ -87,6 +93,8 @@ class ColorBlock(object):
@property
def stop_after(self):
+ # TODO: we do not add the stop command necessarily as the last stitch
+ # also we do not necessarily start a new color block when a stop command appears
if self.last_stitch is not None:
return self.last_stitch.stop
else:
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py
index f6e3f0de..8439de18 100644
--- a/lib/stitch_plan/stitch_plan.py
+++ b/lib/stitch_plan/stitch_plan.py
@@ -172,7 +172,7 @@ class StitchPlan(object):
@property
def num_stops(self):
- return sum(1 for block in self if block.stop_after)
+ return sum(block.num_stops for block in self)
@property
def num_trims(self):