From 512c3411648b24505165d555a04e82ba689f8aed Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 19 Aug 2018 22:14:10 -0400 Subject: integrate inx generation into ink/stitch proper --- lib/inx/extensions.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 lib/inx/extensions.py (limited to 'lib/inx/extensions.py') diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py new file mode 100755 index 00000000..ba206d8f --- /dev/null +++ b/lib/inx/extensions.py @@ -0,0 +1,21 @@ +import pyembroidery + +from .utils import build_environment, write_inx_file +from .outputs import pyembroidery_output_formats +from ..extensions import extensions + + +def pyembroidery_debug_formats(): + for format in pyembroidery.supported_formats(): + if 'writer' in format and format['category'] != 'embroidery': + yield format['extension'], format['description'] + + +def generate_extension_inx_files(): + env = build_environment() + + for extension in extensions: + name = extension.name() + template = env.get_template('%s.inx' % name) + write_inx_file(name, template.render(formats=pyembroidery_output_formats(), + debug_formats=pyembroidery_debug_formats())) -- cgit v1.2.3 From 871358d990d4a06b2eaaf0e405f2d18e26753d52 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 20 Aug 2018 15:49:19 -0400 Subject: gettextify INX templates --- lib/inx/extensions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/inx/extensions.py') diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py index ba206d8f..2b097440 100755 --- a/lib/inx/extensions.py +++ b/lib/inx/extensions.py @@ -2,7 +2,7 @@ import pyembroidery from .utils import build_environment, write_inx_file from .outputs import pyembroidery_output_formats -from ..extensions import extensions +from ..extensions import extensions, Input, Output def pyembroidery_debug_formats(): @@ -15,6 +15,9 @@ def generate_extension_inx_files(): env = build_environment() for extension in extensions: + if extension is Input or extension is Output: + continue + name = extension.name() template = env.get_template('%s.inx' % name) write_inx_file(name, template.render(formats=pyembroidery_output_formats(), -- cgit v1.2.3 From 082e1664bb1dc6edfcae7aef65021109d6da28da Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 22 Aug 2018 22:54:15 -0400 Subject: fix missing layer and object commands --- lib/inx/extensions.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/inx/extensions.py') diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py index 2b097440..4b4b3c13 100755 --- a/lib/inx/extensions.py +++ b/lib/inx/extensions.py @@ -3,6 +3,18 @@ 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 + + +def layer_commands(): + # We purposefully avoid using commands.get_command_description() here. We + # want to call _() on the description inside the actual template so that + # we use the translation language selected in build_environment(). + return [(command, COMMANDS[command]) for command in LAYER_COMMANDS] + + +def object_commands(): + return [(command, COMMANDS[command]) for command in OBJECT_COMMANDS] def pyembroidery_debug_formats(): @@ -21,4 +33,6 @@ def generate_extension_inx_files(): name = extension.name() template = env.get_template('%s.inx' % name) write_inx_file(name, template.render(formats=pyembroidery_output_formats(), - debug_formats=pyembroidery_debug_formats())) + debug_formats=pyembroidery_debug_formats(), + layer_commands=layer_commands(), + object_commands=object_commands())) -- cgit v1.2.3 From 53f92df05635668783a6b9407a01326de14a1291 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 24 Aug 2018 16:29:13 -0400 Subject: add 'Add Commands' extension --- lib/inx/extensions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/inx/extensions.py') 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())) -- cgit v1.2.3