summaryrefslogtreecommitdiff
path: root/lib/elements/utils.py
diff options
context:
space:
mode:
authorGeorge Steel <george.steel@gmail.com>2022-12-10 19:27:20 -0500
committerGeorge Steel <george.steel@gmail.com>2022-12-10 19:29:01 -0500
commit2cec72cbbd73b2dece5d15715e2ab8bddd417c69 (patch)
treeaff4569cb68f626e05489a86511fbd4be8325e17 /lib/elements/utils.py
parent495a22ea55234e032ac526450fd7969d9aa799c8 (diff)
parente52f889bb0cb208685b3f3ef8271f63ecd318af1 (diff)
Merge branch 'george-steel/expose-trim-after'
Diffstat (limited to 'lib/elements/utils.py')
-rw-r--r--lib/elements/utils.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/elements/utils.py b/lib/elements/utils.py
index dafde759..f7ee8dbc 100644
--- a/lib/elements/utils.py
+++ b/lib/elements/utils.py
@@ -6,11 +6,11 @@
from ..commands import is_command
from ..marker import has_marker
from ..svg.tags import (EMBROIDERABLE_TAGS, SVG_IMAGE_TAG, SVG_PATH_TAG,
- SVG_POLYLINE_TAG, SVG_TEXT_TAG)
-from .fill_stitch import FillStitch
+ SVG_POLYGON_TAG, SVG_POLYLINE_TAG, SVG_TEXT_TAG)
from .clone import Clone, is_clone
from .element import EmbroideryElement
from .empty_d_object import EmptyDObject
+from .fill_stitch import FillStitch
from .image import ImageObject
from .marker import MarkerObject
from .polyline import Polyline
@@ -27,7 +27,8 @@ def node_to_elements(node, clone_to_element=False): # noqa: C901
# clone_to_element: get an actual embroiderable element once a clone has been defined as a clone
return [Clone(node)]
- elif node.tag == SVG_PATH_TAG and not node.get('d', ''):
+ elif ((node.tag == SVG_PATH_TAG and not node.get('d', None)) or
+ (node.tag in [SVG_POLYLINE_TAG, SVG_POLYGON_TAG] and not node.get('points', None))):
return [EmptyDObject(node)]
elif has_marker(node):
@@ -36,18 +37,17 @@ def node_to_elements(node, clone_to_element=False): # noqa: C901
elif node.tag in EMBROIDERABLE_TAGS or is_clone(node):
element = EmbroideryElement(node)
- if element.get_boolean_param("satin_column") and element.get_style("stroke"):
- return [SatinColumn(node)]
- else:
- elements = []
- if element.get_style("fill", "black") and not element.get_style('fill-opacity', 1) == "0":
- elements.append(FillStitch(node))
- if element.get_style("stroke"):
- if not is_command(element.node):
- elements.append(Stroke(node))
- if element.get_boolean_param("stroke_first", False):
- elements.reverse()
- return elements
+ elements = []
+ if element.get_style("fill", "black") and not element.get_style('fill-opacity', 1) == "0":
+ elements.append(FillStitch(node))
+ if element.get_style("stroke"):
+ if element.get_boolean_param("satin_column"):
+ elements.append(SatinColumn(node))
+ elif not is_command(element.node):
+ elements.append(Stroke(node))
+ if element.get_boolean_param("stroke_first", False):
+ elements.reverse()
+ return elements
elif node.tag == SVG_IMAGE_TAG:
return [ImageObject(node)]