diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-05-01 21:21:07 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-05-01 21:21:07 -0400 |
| commit | 05daffb7e01db55879eb24f3c00532324a5d41af (patch) | |
| tree | 43ff5d954e035e0e8b5a507b9c1bf9d6b4d3338d /lib/stitch_plan | |
| parent | 1b31806423c8fec4040fed6d1009db016860b763 (diff) | |
refactor everything out of lib/__init__.py
Diffstat (limited to 'lib/stitch_plan')
| -rw-r--r-- | lib/stitch_plan/__init__.py | 1 | ||||
| -rw-r--r-- | lib/stitch_plan/stitch.py | 15 | ||||
| -rw-r--r-- | lib/stitch_plan/stitch_plan.py | 5 | ||||
| -rw-r--r-- | lib/stitch_plan/ties.py | 6 |
4 files changed, 23 insertions, 4 deletions
diff --git a/lib/stitch_plan/__init__.py b/lib/stitch_plan/__init__.py index 6c1f418a..791a5f20 100644 --- a/lib/stitch_plan/__init__.py +++ b/lib/stitch_plan/__init__.py @@ -1 +1,2 @@ from stitch_plan import patches_to_stitch_plan, StitchPlan, ColorBlock +from .stitch import Stitch diff --git a/lib/stitch_plan/stitch.py b/lib/stitch_plan/stitch.py new file mode 100644 index 00000000..6a8579c2 --- /dev/null +++ b/lib/stitch_plan/stitch.py @@ -0,0 +1,15 @@ +from ..utils.geometry import Point + + +class Stitch(Point): + def __init__(self, x, y, color=None, jump=False, stop=False, trim=False, no_ties=False): + self.x = x + self.y = y + self.color = color + self.jump = jump + self.trim = trim + self.stop = stop + self.no_ties = no_ties + + def __repr__(self): + return "Stitch(%s, %s, %s, %s, %s, %s, %s)" % (self.x, self.y, self.color, "JUMP" if self.jump else " ", "TRIM" if self.trim else " ", "STOP" if self.stop else " ", "NO TIES" if self.no_ties else " ") diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index fab87876..570a7645 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -1,8 +1,9 @@ -from .. import Stitch, PIXELS_PER_MM -from ..utils.geometry import Point +from .stitch import Stitch from .stop import process_stop from .trim import process_trim from .ties import add_ties +from ..svg import PIXELS_PER_MM +from ..utils.geometry import Point from ..threads import ThreadColor diff --git a/lib/stitch_plan/ties.py b/lib/stitch_plan/ties.py index 1207ea51..f9c5b721 100644 --- a/lib/stitch_plan/ties.py +++ b/lib/stitch_plan/ties.py @@ -1,7 +1,9 @@ +from copy import deepcopy + +from .stitch import Stitch from ..utils import cut_path from ..stitches import running_stitch -from .. import Stitch -from copy import deepcopy + def add_tie(stitches, tie_path): if stitches[-1].no_ties: |
