diff options
Diffstat (limited to 'lib/threads')
| -rw-r--r-- | lib/threads/__init__.py | 6 | ||||
| -rw-r--r-- | lib/threads/catalog.py | 2 | ||||
| -rw-r--r-- | lib/threads/color.py | 9 | ||||
| -rw-r--r-- | lib/threads/palette.py | 5 |
4 files changed, 11 insertions, 11 deletions
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 |
