From a1c34b12033208ae69a70338106ee0b93fc1b898 Mon Sep 17 00:00:00 2001 From: Tatarize Date: Thu, 4 Mar 2021 18:42:35 -0800 Subject: [PATCH] Integrate Version --- pyembroidery/JefReader.py | 3 ++- pyembroidery/JefWriter.py | 1 - pyembroidery/PecWriter.py | 2 +- test/test_encoder.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyembroidery/JefReader.py b/pyembroidery/JefReader.py index 2dec4d6..dd884d5 100644 --- a/pyembroidery/JefReader.py +++ b/pyembroidery/JefReader.py @@ -23,6 +23,7 @@ def read_jef_stitches(f, out, settings=None): out.move(x, y) continue if ctrl == 0x01: + # PATCH: None means stop since it was color #0 if out.threadlist[color_index] is None: out.stop(0, 0) del out.threadlist[color_index] @@ -61,10 +62,10 @@ def read(f, out, settings=None): for i in range(0, count_colors): index = abs(read_int_32le(f)) if index == 0: + # Patch: If we have color 0. Go ahead and set that to None. out.threadlist.append(None) else: out.add_thread(jef_threads[index % len(jef_threads)]) - print(out.threadlist) f.seek(stitch_offset, 0) read_jef_stitches(f, out, settings) diff --git a/pyembroidery/JefWriter.py b/pyembroidery/JefWriter.py index edf3886..0fdace4 100644 --- a/pyembroidery/JefWriter.py +++ b/pyembroidery/JefWriter.py @@ -1,7 +1,6 @@ import datetime from .EmbConstant import * -from .EmbThread import build_nonrepeat_palette from .EmbThreadJef import get_thread_set from .WriteHelper import write_int_8, write_int_32le, write_string_utf8 diff --git a/pyembroidery/PecWriter.py b/pyembroidery/PecWriter.py index ef58829..3d95b17 100644 --- a/pyembroidery/PecWriter.py +++ b/pyembroidery/PecWriter.py @@ -60,7 +60,7 @@ def write_pec_header(pattern, f, threadlist): f.write(b"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20") add_value = current_thread_count - 1 color_index_list.insert(0, add_value) - assert color_index_list[0]<255, 'to many color changes, ({0}) out of bounds (0, 255)'.format(len(color_index_list)) + assert color_index_list[0] < 255, 'too many color changes, ({0}) out of bounds (0, 255)'.format(len(color_index_list)) f.write(bytes(bytearray(color_index_list))) else: f.write(b"\x20\x20\x20\x20\x64\x20\x00\x20\x00\x20\x20\x20\xFF") diff --git a/test/test_encoder.py b/test/test_encoder.py index 2d66c67..6cce6a0 100644 --- a/test/test_encoder.py +++ b/test/test_encoder.py @@ -110,4 +110,4 @@ class TestEmbpattern(unittest.TestCase): from pyembroidery.EmbEncoder import Transcoder encoder = Transcoder() encoder.transcode(pattern, pattern) - self.assertNotEquals(len(pattern.stitches), 0) + self.assertNotEqual(len(pattern.stitches), 0)