summaryrefslogtreecommitdiff
path: root/lib/extensions/auto_satin.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-12-14 16:49:42 +0100
committerGitHub <noreply@github.com>2024-12-14 16:49:42 +0100
commit1f3f15efdeb569854f54fa4be22b35bb45ae1996 (patch)
tree864fc4ee80116ea7e6ac6c8d8d45216ab3e0e807 /lib/extensions/auto_satin.py
parent1abd3051325273f139508429821c5aad7ca39266 (diff)
auto satin: add option to keep original path elements (#3332)
Diffstat (limited to 'lib/extensions/auto_satin.py')
-rw-r--r--lib/extensions/auto_satin.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/extensions/auto_satin.py b/lib/extensions/auto_satin.py
index d5456bcb..a5e6ab3f 100644
--- a/lib/extensions/auto_satin.py
+++ b/lib/extensions/auto_satin.py
@@ -20,6 +20,7 @@ class AutoSatin(CommandsExtension):
CommandsExtension.__init__(self, *args, **kwargs)
self.arg_parser.add_argument("--notebook")
self.arg_parser.add_argument("-p", "--preserve_order", dest="preserve_order", type=inkex.Boolean, default=False)
+ self.arg_parser.add_argument("-k", "--keep_originals", dest="keep_originals", type=inkex.Boolean, default=False)
def get_starting_point(self):
return self.get_point("autoroute_start")
@@ -56,6 +57,13 @@ class AutoSatin(CommandsExtension):
return True
+ def _get_parent_and_index(self):
+ last_element = self.svg.selection[-1]
+ if last_element.TAG == 'g':
+ parent = last_element.getparent()
+ return parent, parent.index(last_element) + 1
+ return None, None
+
def effect(self):
if not self.check_selection():
return
@@ -71,4 +79,5 @@ class AutoSatin(CommandsExtension):
if not elements:
return
- auto_satin(elements, self.options.preserve_order, starting_point, ending_point, self.options.trim)
+ parent, index = self._get_parent_and_index()
+ auto_satin(elements, self.options.preserve_order, starting_point, ending_point, self.options.trim, self.options.keep_originals, parent, index)