summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-05 07:01:15 +0200
committerGitHub <noreply@github.com>2024-06-05 07:01:15 +0200
commitf153a6c27bbf20207d1fd18a503c82ac15a0f7e4 (patch)
treef3d4263f6e96593f5cd6d0e03557840d050a6ecb /lib
parent67bba9c466566022f4f8e58e1c8f6146faceaef1 (diff)
fix print pdf whith active realistic stitch plan (png) (#2967)
Diffstat (limited to 'lib')
-rw-r--r--lib/svg/rendering.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/svg/rendering.py b/lib/svg/rendering.py
index 6696597e..a153ff95 100644
--- a/lib/svg/rendering.py
+++ b/lib/svg/rendering.py
@@ -217,20 +217,15 @@ def color_block_to_paths(color_block, svg, destination, visual_commands, render_
def render_stitch_plan(svg, stitch_plan, realistic=False, visual_commands=True, render_jumps=True) -> inkex.Group:
- layer = svg.findone(".//*[@id='__inkstitch_stitch_plan__']")
- if layer is None:
- layer = inkex.Group(attrib={
- 'id': '__inkstitch_stitch_plan__',
- INKSCAPE_LABEL: _('Stitch Plan'),
- INKSCAPE_GROUPMODE: 'layer'
- })
- else:
- # delete old stitch plan
- del layer[:]
-
- # make sure the layer is visible
- layer.set('style', 'display:inline')
-
+ layer_or_image = svg.findone(".//*[@id='__inkstitch_stitch_plan__']")
+ if layer_or_image is not None:
+ layer_or_image.getparent().remove(layer_or_image)
+
+ layer = inkex.Group(attrib={
+ 'id': '__inkstitch_stitch_plan__',
+ INKSCAPE_LABEL: _('Stitch Plan'),
+ INKSCAPE_GROUPMODE: 'layer'
+ })
svg.append(layer)
for i, color_block in enumerate(stitch_plan):