summaryrefslogtreecommitdiff
path: root/lib/extensions/object_commands_toggle_visibility.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-04-10 10:21:59 +0200
committerGitHub <noreply@github.com>2022-04-10 10:21:59 +0200
commit7ecfa7a2e6b2c971f35d8264c35b3efdae212489 (patch)
tree195e932b557e9d34ace426cac0d8a599479da654 /lib/extensions/object_commands_toggle_visibility.py
parentc575aeda96d389de29389c9e6e46395e1b938244 (diff)
Scale and toggle commands (etc) (#1611)
* scale and toggle commands * fix tie in when first stitch is a jump stitch * set tie modus to 3 for cutwork objects * cutwork set stitch length * fix bug in remove embroidery settings
Diffstat (limited to 'lib/extensions/object_commands_toggle_visibility.py')
-rw-r--r--lib/extensions/object_commands_toggle_visibility.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/extensions/object_commands_toggle_visibility.py b/lib/extensions/object_commands_toggle_visibility.py
new file mode 100644
index 00000000..569f4305
--- /dev/null
+++ b/lib/extensions/object_commands_toggle_visibility.py
@@ -0,0 +1,24 @@
+# Authors: see git history
+#
+# Copyright (c) 2022 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+from inkex import NSS
+
+from .base import InkstitchExtension
+
+
+class ObjectCommandsToggleVisibility(InkstitchExtension):
+
+ def effect(self):
+ svg = self.document.getroot()
+ # toggle object commands (in fact it's display or hide all of them)
+ command_groups = svg.xpath(".//svg:g[starts-with(@id,'command_group')]", namespaces=NSS)
+ display = "none"
+ first_iteration = True
+ for command_group in command_groups:
+ if first_iteration:
+ first_iteration = False
+ if not command_group.is_visible():
+ display = "inline"
+ command_group.style['display'] = display