summaryrefslogtreecommitdiff
path: root/lib/threads
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2021-03-04 18:40:53 +0100
committerGitHub <noreply@github.com>2021-03-04 18:40:53 +0100
commite84a86d4ac0caf29d6074728376ff0a594243fec (patch)
tree888c79ed0094ba2916a1d329861a85515959913c /lib/threads
parentb39575a50191307b3b56eab6455626398eec6397 (diff)
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 <rumpeltux-github@irgendwo.org> Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'lib/threads')
-rw-r--r--lib/threads/__init__.py6
-rw-r--r--lib/threads/catalog.py2
-rw-r--r--lib/threads/color.py9
-rw-r--r--lib/threads/palette.py5
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