Remove previous troubleshoot layer (#2638)

... instead of deleting content
pull/2656/head
Kaalleen 2023-12-25 08:49:46 +01:00 zatwierdzone przez GitHub
rodzic 9afbf02384
commit 5daa3aa3f0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 12 dodań i 10 usunięć

Wyświetl plik

@ -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"])