diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2022-12-17 12:27:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-17 12:27:09 +0100 |
| commit | 4286090570832186edab14b24c7dc8cd2fba7c65 (patch) | |
| tree | 605306aed85331b8566cdd526094fc68583ce2d9 /lib | |
| parent | 355e1f3b9a0337c5c6ee6bb22a4c7e3fa6b936bd (diff) | |
fix #1921 (#1922)
Diffstat (limited to 'lib')
| -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) |
