summaryrefslogtreecommitdiff
path: root/lib/extensions/stitch_plan_preview_undo.py
diff options
context:
space:
mode:
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