summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2023-12-25 08:49:46 +0100
committerGitHub <noreply@github.com>2023-12-25 08:49:46 +0100
commit5daa3aa3f0daf5b6e48b5718117601fb0a9cf4ac (patch)
tree58a1a364ee8d8920042d857951489def942b83a0 /lib/extensions
parent9afbf02384400f53e9fb762b3a986b65e4e9b75e (diff)
Remove previous troubleshoot layer (#2638)
... instead of deleting content
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/troubleshoot.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/extensions/troubleshoot.py b/lib/extensions/troubleshoot.py
index fdc7fa9e..01629069 100644
--- a/lib/extensions/troubleshoot.py
+++ b/lib/extensions/troubleshoot.py
@@ -100,16 +100,18 @@ class Troubleshoot(InkstitchExtension):
svg = self.document.getroot()
layer = svg.find(".//*[@id='__validation_layer__']")
- if layer is None:
- layer = inkex.Group(attrib={
- 'id': '__validation_layer__',
- INKSCAPE_LABEL: _('Troubleshoot'),
- INKSCAPE_GROUPMODE: 'layer',
- })
- svg.append(layer)
- else:
- # Clear out everything from the last run
- del layer[:]
+ if layer is not None:
+ # Remove the old layer - they may have used tranfsorms
+ # or moved it into an other group (which could lead to more transforms)
+ # We don't want to deal with it.
+ layer.getparent().remove(layer)
+
+ layer = inkex.Group(attrib={
+ 'id': '__validation_layer__',
+ INKSCAPE_LABEL: _('Troubleshoot'),
+ INKSCAPE_GROUPMODE: 'layer',
+ })
+ svg.append(layer)
add_layer_commands(layer, ["ignore_layer"])