diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-08-24 16:29:13 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-08-24 20:56:41 -0400 |
| commit | 53f92df05635668783a6b9407a01326de14a1291 (patch) | |
| tree | bd249267b3cdb965b9c61f644058d679bab48e67 /lib | |
| parent | 7f9208ae2a97026019ff36d28faf37a5c1b9b270 (diff) | |
add 'Add Commands' extension
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/commands.py | 3 | ||||
| -rw-r--r-- | lib/extensions/__init__.py | 2 | ||||
| -rw-r--r-- | lib/extensions/global_commands.py | 14 | ||||
| -rwxr-xr-x | lib/inx/extensions.py | 9 |
4 files changed, 25 insertions, 3 deletions
diff --git a/lib/commands.py b/lib/commands.py index 3a4ca230..db3c8a71 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -31,11 +31,12 @@ COMMANDS = { N_("origin"): N_("Origin for exported embroidery files"), # L10N command that affects entire document - N_("stop_point"): N_("Jump destination for Stop commands (a.k.a. \"Frame Out position\")."), + N_("stop_position"): N_("Jump destination for Stop commands (a.k.a. \"Frame Out position\")."), } OBJECT_COMMANDS = ["fill_start", "fill_end", "stop", "trim", "ignore_object"] LAYER_COMMANDS = ["ignore_layer"] +GLOBAL_COMMANDS = ["origin", "stop_position"] class CommandParseError(Exception): diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index cf0313b2..5b72ecb3 100644 --- a/lib/extensions/__init__.py +++ b/lib/extensions/__init__.py @@ -9,6 +9,7 @@ from zip import Zip from flip import Flip from object_commands import ObjectCommands from layer_commands import LayerCommands +from global_commands import GlobalCommands from convert_to_satin import ConvertToSatin __all__ = extensions = [Embroider, @@ -22,4 +23,5 @@ __all__ = extensions = [Embroider, Flip, ObjectCommands, LayerCommands, + GlobalCommands, ConvertToSatin] diff --git a/lib/extensions/global_commands.py b/lib/extensions/global_commands.py new file mode 100644 index 00000000..55848be9 --- /dev/null +++ b/lib/extensions/global_commands.py @@ -0,0 +1,14 @@ +import inkex + +from .layer_commands import LayerCommands +from ..commands import GLOBAL_COMMANDS + + +# It's a bit weird subclassing this from LayerCommands, but global commands +# must still be placed in a layer. That means the two extensions +# do the same thing and the code is the same. We keep this as separate +# extensions because we want the user to understand that global commands +# affect the entire document, not just the current layer. + +class GlobalCommands(LayerCommands): + COMMANDS = GLOBAL_COMMANDS diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py index 4b4b3c13..d1a0c7f3 100755 --- a/lib/inx/extensions.py +++ b/lib/inx/extensions.py @@ -3,7 +3,7 @@ import pyembroidery from .utils import build_environment, write_inx_file from .outputs import pyembroidery_output_formats from ..extensions import extensions, Input, Output -from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, COMMANDS +from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, GLOBAL_COMMANDS, COMMANDS def layer_commands(): @@ -13,6 +13,10 @@ def layer_commands(): return [(command, COMMANDS[command]) for command in LAYER_COMMANDS] +def global_commands(): + return [(command, COMMANDS[command]) for command in GLOBAL_COMMANDS] + + def object_commands(): return [(command, COMMANDS[command]) for command in OBJECT_COMMANDS] @@ -35,4 +39,5 @@ def generate_extension_inx_files(): write_inx_file(name, template.render(formats=pyembroidery_output_formats(), debug_formats=pyembroidery_debug_formats(), layer_commands=layer_commands(), - object_commands=object_commands())) + object_commands=object_commands(), + global_commands=global_commands())) |
