summaryrefslogtreecommitdiff
path: root/lib/extensions/tartan.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-30 22:49:18 +0200
committerGitHub <noreply@github.com>2024-06-30 22:49:18 +0200
commite52886a64a4e76c3fdc49df95c85655da3c4f7f4 (patch)
tree88a4edee630df0947553ced79fb6eb9dc510ccea /lib/extensions/tartan.py
parent7c06dee44ac7951a5db406eb829100a5bc3e5887 (diff)
Various fixes (#3028)
* several thread palette extension fixes * fix svg tartan when original shape is invalid * tartan stroke spaces * style * fix tartan color substituion at pattern start * ripple: do not render too small paths * use less space for params warning headline * fix clone shape path * zip export template fix (typo) * add realistic stitch plan output warning (help tab)
Diffstat (limited to 'lib/extensions/tartan.py')
-rw-r--r--lib/extensions/tartan.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/extensions/tartan.py b/lib/extensions/tartan.py
index 8c3c8c5f..3acb659c 100644
--- a/lib/extensions/tartan.py
+++ b/lib/extensions/tartan.py
@@ -28,11 +28,8 @@ class Tartan(InkstitchExtension):
def get_tartan_elements(self):
if self.svg.selection:
- self._get_elements()
-
- def _get_elements(self):
- for node in self.svg.selection:
- self.get_selection(node)
+ for node in self.svg.selection:
+ self.get_selection(node)
def get_selection(self, node):
if node.TAG == 'g' and not node.get_id().startswith('inkstitch-tartan'):
@@ -40,13 +37,13 @@ class Tartan(InkstitchExtension):
self.get_selection(child_node)
else:
node = self.get_outline(node)
- if node.tag in EMBROIDERABLE_TAGS and node.style('fill'):
+ if node.tag in EMBROIDERABLE_TAGS and node.style('fill') is not None:
self.elements.add(node)
def get_outline(self, node):
# existing tartans are marked through their outline element
# we have either selected the element itself or some other element within a tartan group
- if node.get(INKSTITCH_TARTAN, None):
+ if node.get(INKSTITCH_TARTAN, None) is not None:
return node
if node.get_id().startswith('inkstitch-tartan'):
for element in node.iterchildren(EMBROIDERABLE_TAGS):
@@ -55,7 +52,7 @@ class Tartan(InkstitchExtension):
for group in node.iterancestors(SVG_GROUP_TAG):
if group.get_id().startswith('inkstitch-tartan'):
for element in group.iterchildren(EMBROIDERABLE_TAGS):
- if element.get(INKSTITCH_TARTAN, None):
+ if element.get(INKSTITCH_TARTAN, None) is not None:
return element
# if we don't find an existing tartan, return node
return node