summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-11-19 16:46:09 +0100
committerGitHub <noreply@github.com>2024-11-19 16:46:09 +0100
commit7c0e1d0fb76b7ce3803dfff3844065686304007e (patch)
tree7697de5339e8ae05543137648a21bb634961dc23 /lib/extensions
parent8a4afa1db265788e540e53c2c1f162fa3c38e250 (diff)
make remove commands more robust for broken commands with active selection (#3288)
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/remove_embroidery_settings.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/extensions/remove_embroidery_settings.py b/lib/extensions/remove_embroidery_settings.py
index a082f70f..90c6d68c 100644
--- a/lib/extensions/remove_embroidery_settings.py
+++ b/lib/extensions/remove_embroidery_settings.py
@@ -5,7 +5,7 @@
from inkex import NSS, Boolean, ShapeElement
-from ..commands import OBJECT_COMMANDS, find_commands
+from ..commands import OBJECT_COMMANDS, find_commands, is_command_symbol
from ..svg.svg import find_elements
from .base import InkstitchExtension
@@ -77,10 +77,19 @@ class RemoveEmbroiderySettings(InkstitchExtension):
self.remove_elements(symbols)
def remove_selected_commands(self):
+ del_option = self.options.del_commands
elements = self.get_selected_elements()
for element in elements:
+ if is_command_symbol(element) and (del_option in element.get('xlink:href') or del_option == 'all'):
+ group = element.getparent()
+ if group.getparent() is not None:
+ if group.get_id().startswith("command_group"):
+ group.getparent().remove(group)
+ else:
+ group.remove(element)
+ continue
for command in find_commands(element):
- if self.options.del_commands in ('all', command.command):
+ if del_option in ('all', command.command):
group = command.connector.getparent()
group.getparent().remove(group)