diff options
| -rw-r--r-- | lib/extensions/jump_to_trim.py | 13 | ||||
| -rw-r--r-- | templates/jump_to_trim.xml | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/extensions/jump_to_trim.py b/lib/extensions/jump_to_trim.py index 2944c79a..61433fa0 100644 --- a/lib/extensions/jump_to_trim.py +++ b/lib/extensions/jump_to_trim.py @@ -17,6 +17,7 @@ class JumpToTrim(InkstitchExtension): InkstitchExtension.__init__(self, *args, **kwargs) self.arg_parser.add_argument("--tab") + self.arg_parser.add_argument("-c", "--command", type=str, default="trim", dest="command") self.arg_parser.add_argument("-i", "--minimum-jump-length", type=float, default=3.0, dest="min_jump") self.arg_parser.add_argument("-a", "--maximum-jump-length", type=float, default=0, dest="max_jump") self.arg_parser.add_argument("-t", "--use-command-symbols", type=Boolean, default=False, dest="use_command_symbols") @@ -59,14 +60,20 @@ class JumpToTrim(InkstitchExtension): self._add_trim(last) def _add_trim(self, element): + command = "trim" + param = "trim_after" + if self.options.command == "stop": + command = "stop" + param = "stop_after" + # skip if the element already has a trim command in one way or the other - if element.has_command("trim") or element.trim_after: + if element.has_command(command) or element.trim_after: return if self.options.use_command_symbols: - add_commands(element, ["trim"]) + add_commands(element, [command]) else: - element.node.set('inkstitch:trim_after', True) + element.node.set(f'inkstitch:{param}', True) def _set_selection(self): if not self.svg.selection: diff --git a/templates/jump_to_trim.xml b/templates/jump_to_trim.xml index a23131b3..bd246736 100644 --- a/templates/jump_to_trim.xml +++ b/templates/jump_to_trim.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension translationdomain="inkstitch" xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <name>Jump Stitch to Trim Command</name> + <name>Jump Stitch to Trim/Stop Command</name> <id>org.{{ id_inkstitch }}.jump_to_trim</id> <param name="extension" type="string" gui-hidden="true">jump_to_trim</param> <effect> @@ -15,6 +15,10 @@ </effect> <param name="tab" type="notebook"> <page name="options" gui-text="Options"> + <param name="command" type="optiongroup" appearance="combo" gui-text="Command"> + <option value="trim">Trim</option> + <option value="stop">Stop</option> + </param> <param name="minimum-jump-length" type="float" precision="2" min="0" max="100" gui-text="Convert jumps not shorter than (mm)">3.0</param> <param name="maximum-jump-length" type="float" precision="2" min="0" max="10000" @@ -25,7 +29,7 @@ <param name="use-command-symbol" type="boolean" indent="1" gui-text="Use command symbol">false</param> </page> <page name="info" gui-text="Help"> - <label appearance="header">This extension inserts trim commands to avoid jump stitches.</label> + <label appearance="header">This extension inserts trim or stop commands to avoid jump stitches.</label> <label>Get more information on our website</label> <label appearance="url">https://inkstitch.org/docs/commands/#jump-to-trim</label> </page> |
