summaryrefslogtreecommitdiff
path: root/lib/extensions/stitch_plan_preview_undo.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-01-14 20:42:36 +0100
committerGitHub <noreply@github.com>2024-01-14 20:42:36 +0100
commitd57bbb0f94863e0c7e6d426a972a4fcf4a00ac2d (patch)
tree44177454edea342d02e3824942568702f1f822e3 /lib/extensions/stitch_plan_preview_undo.py
parentc3193c68764bb82f49952e6a51a6ceaa10a2e82c (diff)
Stitch plan preview overwrite option (#2642)
Diffstat (limited to 'lib/extensions/stitch_plan_preview_undo.py')
-rw-r--r--lib/extensions/stitch_plan_preview_undo.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/extensions/stitch_plan_preview_undo.py b/lib/extensions/stitch_plan_preview_undo.py
index f5cac709..af4c8722 100644
--- a/lib/extensions/stitch_plan_preview_undo.py
+++ b/lib/extensions/stitch_plan_preview_undo.py
@@ -12,14 +12,15 @@ class StitchPlanPreviewUndo(InkstitchExtension):
reset_stitch_plan(self.document.getroot())
-def reset_stitch_plan(svg):
+def reset_stitch_plan(svg, delete_stitch_plan=True):
# delete old stitch plan
layer = svg.find(".//*[@id='__inkstitch_stitch_plan__']")
# get previously invisible layers (they still should be hidden afterwards)
if layer is not None:
display_method = layer.get(INKSTITCH_ATTRIBS['layer_visibility'], 'unchanged')
invisible_layers = layer.get(INKSTITCH_ATTRIBS['invisible_layers'], '').split(",")
- layer.getparent().remove(layer)
+ if delete_stitch_plan:
+ layer.getparent().remove(layer)
if display_method == "unchanged":
return