diff options
| author | George Steel <george.steel@gmail.com> | 2022-12-23 19:26:43 -0500 |
|---|---|---|
| committer | George Steel <george.steel@gmail.com> | 2022-12-23 19:26:43 -0500 |
| commit | 7d60b8e9d31ff8b0d98eba2bbc5ad9415c18170d (patch) | |
| tree | dbdca3cc6ae29392c8a4be5cd1f91211aaf0d499 /lib/commands.py | |
| parent | 54b0a3d6bf77b4c7b23f299ae1600399b80092df (diff) | |
| parent | aaa9daa86ccd37fd9d8f8840ce9bd9dcc95b2c92 (diff) | |
Merge branch 'main' of https://github.com/inkstitch/inkstitch into george-steel/random-base-satin
Diffstat (limited to 'lib/commands.py')
| -rw-r--r-- | lib/commands.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/commands.py b/lib/commands.py index 6280fc0c..f30d6423 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -407,7 +407,18 @@ def add_commands(element, commands): def add_layer_commands(layer, commands): svg = layer.root - correction_transform = get_correction_transform(layer) + + if not layer.tag_name == 'svg': + correction_transform = get_correction_transform(layer) + else: + # No layer selected while trying to include only layer commands: return a error message and exit + # Since global and layer commands will not be inserted at the same time, we can check the first command only + if commands[0] in LAYER_COMMANDS: + inkex.errormsg(_('Please select a layer to include layer commands.')) + sys.exit(1) + + # global commands do not necesarrily need a layer + correction_transform = '' for i, command in enumerate(commands): ensure_symbol(svg, command) |
