summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-02-17 10:13:09 -0500
committerLex Neva <github.com@lexneva.name>2018-02-17 10:13:09 -0500
commit4c5e57893992e64ac3509dd05a6a3fd57238cb30 (patch)
treed1b5b0a9bf11c60a874f76450659f1fac7f6e127
parentfe1f49ff9c1d22d1be7703717619d39a77abdbe7 (diff)
fix repeated colors showing as random
-rw-r--r--inkstitch.py15
-rw-r--r--messages.po2
2 files changed, 4 insertions, 13 deletions
diff --git a/inkstitch.py b/inkstitch.py
index c53781fc..0af7807c 100644
--- a/inkstitch.py
+++ b/inkstitch.py
@@ -504,26 +504,17 @@ def write_embroidery_file(file_path, stitches):
min_y = min(stitch.y for stitch in stitches)
pattern = libembroidery.embPattern_create()
- threads = {}
-
last_color = None
for stitch in stitches:
if stitch.color != last_color:
- if stitch.color not in threads:
- thread = make_thread(stitch.color)
- thread_index = add_thread(pattern, thread)
- threads[stitch.color] = thread_index
- else:
- thread_index = threads[stitch.color]
-
- libembroidery.embPattern_changeColor(pattern, thread_index)
+ add_thread(pattern, make_thread(stitch.color))
last_color = stitch.color
flags = get_flags(stitch)
- libembroidery.embPattern_addStitchAbs(pattern, stitch.x - min_x, stitch.y - min_y, flags, 0)
+ libembroidery.embPattern_addStitchAbs(pattern, stitch.x - min_x, stitch.y - min_y, flags, 1)
- libembroidery.embPattern_addStitchAbs(pattern, stitch.x - min_x, stitch.y - min_y, libembroidery.END, 0)
+ libembroidery.embPattern_addStitchAbs(pattern, stitch.x - min_x, stitch.y - min_y, libembroidery.END, 1)
# convert from pixels to millimeters
libembroidery.embPattern_scale(pattern, 1/PIXELS_PER_MM)
diff --git a/messages.po b/messages.po
index 2f53b9ce..1fa955e7 100644
--- a/messages.po
+++ b/messages.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-02-04 16:24-0500\n"
+"POT-Creation-Date: 2018-02-17 10:13-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"