From e84a86d4ac0caf29d6074728376ff0a594243fec Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Thu, 4 Mar 2021 18:40:53 +0100 Subject: Update for Inkscape 1.0 (#880) * update for inkscape 1.0 * add about extension * Build improvements for the inkscape1.0 branch (#985) * zip: export real svg not stitch plan * #411 and #726 * Tools for Font Creators (#1018) * ignore very small holes in fills * remove embroider (#1026) * auto_fill: ignore shrink_or_grow if result is empty (#589) * break apart: do not ignore small fills Co-authored-by: Hagen Fritsch Co-authored-by: Lex Neva --- lib/threads/__init__.py | 6 +++--- lib/threads/catalog.py | 2 +- lib/threads/color.py | 9 ++++----- lib/threads/palette.py | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/threads') diff --git a/lib/threads/__init__.py b/lib/threads/__init__.py index 03cd777b..1081ea14 100644 --- a/lib/threads/__init__.py +++ b/lib/threads/__init__.py @@ -1,3 +1,3 @@ -from color import ThreadColor -from palette import ThreadPalette -from catalog import ThreadCatalog +from .catalog import ThreadCatalog +from .color import ThreadColor +from .palette import ThreadPalette diff --git a/lib/threads/catalog.py b/lib/threads/catalog.py index aba2696d..c91ce227 100644 --- a/lib/threads/catalog.py +++ b/lib/threads/catalog.py @@ -1,6 +1,6 @@ import os import sys -from collections import Sequence +from collections.abc import Sequence from glob import glob from os.path import dirname, realpath diff --git a/lib/threads/color.py b/lib/threads/color.py index e24856a9..32016112 100644 --- a/lib/threads/color.py +++ b/lib/threads/color.py @@ -2,8 +2,7 @@ import colorsys import re import tinycss2.color3 - -import simplestyle +from inkex import Color from pyembroidery.EmbThread import EmbThread @@ -19,14 +18,14 @@ class ThreadColor(object): self.manufacturer = color.brand self.rgb = (color.get_red(), color.get_green(), color.get_blue()) return - elif isinstance(color, unicode): + elif isinstance(color, str): self.rgb = tinycss2.color3.parse_color(color) # remove alpha channel and multiply with 255 self.rgb = tuple(channel * 255.0 for channel in list(self.rgb)[:-1]) elif isinstance(color, (list, tuple)): self.rgb = tuple(color) elif self.hex_str_re.match(color): - self.rgb = simplestyle.parseColor(color) + self.rgb = Color.parse_str(color)[1] else: raise ValueError("Invalid color: " + repr(color)) @@ -77,7 +76,7 @@ class ThreadColor(object): @property def hex_digits(self): - return "%02X%02X%02X" % self.rgb + return "%02X%02X%02X" % tuple([int(x) for x in self.rgb]) @property def rgb_normalized(self): diff --git a/lib/threads/palette.py b/lib/threads/palette.py index d685e5bb..c5e3002c 100644 --- a/lib/threads/palette.py +++ b/lib/threads/palette.py @@ -1,7 +1,8 @@ -from collections import Set -from colormath.color_objects import sRGBColor, LabColor +from collections.abc import Set + from colormath.color_conversions import convert_color from colormath.color_diff import delta_e_cie1994 +from colormath.color_objects import LabColor, sRGBColor from .color import ThreadColor -- cgit v1.2.3