summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/element.py7
-rw-r--r--lib/elements/fill_stitch.py9
-rw-r--r--lib/elements/satin_column.py2
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index c4e1d640..5c463c53 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -11,7 +11,7 @@ import numpy as np
from inkex import bezier, BaseElement
from ..commands import find_commands
-from ..debug import debug
+from ..debug.debug import debug
from ..exceptions import InkstitchException, format_uncaught_exception
from ..i18n import _
from ..marker import get_marker_elements_cache_key_data
@@ -169,9 +169,12 @@ class EmbroideryElement(object):
return self.node.specified_style()
def get_style(self, style_name, default=None):
- style = self._get_specified_style().get(style_name, default)
+ element_style = self._get_specified_style()
+ style = element_style.get(style_name, default)
if style == 'none':
style = None
+ elif style == 'currentColor':
+ style = element_style(style_name)
return style
@property
diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py
index 47155ce0..6bf52d95 100644
--- a/lib/elements/fill_stitch.py
+++ b/lib/elements/fill_stitch.py
@@ -7,7 +7,7 @@ import math
import re
import numpy as np
-from inkex import Transform
+from inkex import LinearGradient, Transform
from shapely import geometry as shgeo
from shapely.errors import GEOSException
from shapely.ops import nearest_points
@@ -588,9 +588,10 @@ class FillStitch(EmbroideryElement):
@property
def gradient(self):
- color = self.color[5:-1]
- xpath = f'.//svg:defs/svg:linearGradient[@id="{color}"]'
- return self.node.getroottree().getroot().findone(xpath)
+ gradient = self.node.get_computed_style("fill")
+ if isinstance(gradient, LinearGradient):
+ return gradient
+ return None
@property
@param('fill_underlay', _('Underlay'), type='toggle', group=_('Fill Underlay'), default=True)
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index 9cf7bc73..6acb2f52 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -14,7 +14,7 @@ from shapely import affinity as shaffinity
from shapely import geometry as shgeo
from shapely.ops import nearest_points
-from ..debug import debug
+from ..debug.debug import debug
from ..i18n import _
from ..metadata import InkStitchMetadata
from ..stitch_plan import StitchGroup