summaryrefslogtreecommitdiff
path: root/embroider.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2017-12-30 16:05:21 -0500
committerLex Neva <github.com@lexneva.name>2017-12-30 16:05:21 -0500
commit61ed1da1cfb39f6350156bf56ce969efa8899891 (patch)
tree0ceec4537007c3406f48684391e8ef072c476dad /embroider.py
parent42b83d4ec47669f8d88180ebb750dd20fe644079 (diff)
params simulate window
when you change params, a simulate window opens to preview the results right away
Diffstat (limited to 'embroider.py')
-rw-r--r--embroider.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/embroider.py b/embroider.py
index 7ad9ee22..392182e4 100644
--- a/embroider.py
+++ b/embroider.py
@@ -121,7 +121,7 @@ class EmbroideryElement(object):
if param.endswith('_mm'):
# print >> dbg, "get_float_param", param, value, "*", self.options.pixels_per_mm
- value = value * self.options.pixels_per_mm
+ value = value * getattr(self.options, "pixels_per_mm", 10)
return value
@@ -133,7 +133,7 @@ class EmbroideryElement(object):
return default
if param.endswith('_mm'):
- value = int(value * self.options.pixels_per_mm)
+ value = int(value * getattr(self.options, "pixels_per_mm", 10))
return value
@@ -207,7 +207,7 @@ class EmbroideryElement(object):
path = deepcopy(path)
- cspsubdiv(path, self.options.flat)
+ cspsubdiv(path, getattr(self.options, "flat", 0.1))
flattened = []
@@ -500,7 +500,7 @@ class Fill(EmbroideryElement):
# only stitch the first point if it's a reasonable distance away from the
# last stitch
- if not patch.stitches or (beg - patch.stitches[-1]).length() > 0.5 * self.options.pixels_per_mm:
+ if not patch.stitches or (beg - patch.stitches[-1]).length() > 0.5 * getattr(self.options, "pixels_per_mm", 10):
patch.add_stitch(beg)
first_stitch = self.adjust_stagger(beg, angle, row_spacing, max_stitch_length)
@@ -515,7 +515,7 @@ class Fill(EmbroideryElement):
patch.add_stitch(beg + offset * row_direction)
offset += max_stitch_length
- if (end - patch.stitches[-1]).length() > 0.1 * self.options.pixels_per_mm:
+ if (end - patch.stitches[-1]).length() > 0.1 * getattr(self.options, "pixels_per_mm", 10):
patch.add_stitch(end)
@@ -1000,7 +1000,7 @@ class AutoFill(Fill):
patch.add_stitch(PyEmb.Point(*outline.interpolate(pos).coords[0]))
end = PyEmb.Point(*end)
- if (end - patch.stitches[-1]).length() > 0.1 * self.options.pixels_per_mm:
+ if (end - patch.stitches[-1]).length() > 0.1 * getattr(self.options, "pixels_per_mm", 10):
patch.add_stitch(end)
print >> dbg, "end connect_points"
@@ -1941,5 +1941,3 @@ if __name__ == '__main__':
print >> dbg, traceback.format_exc()
dbg.flush()
-
-dbg.close()