From f153a6c27bbf20207d1fd18a503c82ac15a0f7e4 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Wed, 5 Jun 2024 07:01:15 +0200 Subject: fix print pdf whith active realistic stitch plan (png) (#2967) --- lib/svg/rendering.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'lib/svg') 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): -- cgit v1.2.3