From d02ddff4753f89f913613a10cfa766d86f80d9a9 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 22 Aug 2018 14:02:53 -0400 Subject: handle unicode in inx generation --- lib/inx/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inx/utils.py b/lib/inx/utils.py index 6103f360..cd0fdc6e 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -28,7 +28,7 @@ def build_environment(): def write_inx_file(name, contents): inx_file_name = "inkstitch_%s_%s.inx" % (name, current_locale) with open(os.path.join(inx_path, inx_file_name), 'w') as inx_file: - print >> inx_file, contents + print >> inx_file.encode("utf-8"), contents def iterate_inx_locales(): global current_translation, current_locale -- cgit v1.2.3 From 674283c13557a5c0e30d7e8a2048c3297b044888 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 22 Aug 2018 14:12:39 -0400 Subject: fix missing install extension INX file --- lib/extensions/__init__.py | 21 ++++++++++++--------- lib/extensions/install.py | 4 ++++ lib/inx/utils.py | 2 +- messages.po | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index 1606795c..cf0313b2 100644 --- a/lib/extensions/__init__.py +++ b/lib/extensions/__init__.py @@ -11,12 +11,15 @@ from object_commands import ObjectCommands from layer_commands import LayerCommands from convert_to_satin import ConvertToSatin -from base import InkstitchExtension -import inspect - -extensions = [] -for item in locals().values(): - if inspect.isclass(item) and \ - issubclass(item, InkstitchExtension) and \ - item is not InkstitchExtension: - extensions.append(item) +__all__ = extensions = [Embroider, + Install, + Params, + Print, + Simulate, + Input, + Output, + Zip, + Flip, + ObjectCommands, + LayerCommands, + ConvertToSatin] diff --git a/lib/extensions/install.py b/lib/extensions/install.py index 42a92113..3644afad 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -98,6 +98,10 @@ class InstallerFrame(wx.Frame): shutil.copy(palette_file, dest) class Install(inkex.Effect): + @classmethod + def name(cls): + return "install" + def effect(self): app = wx.App() installer_frame = InstallerFrame(None, title=_("Ink/Stitch Add-ons Installer"), size=(550, 250)) diff --git a/lib/inx/utils.py b/lib/inx/utils.py index cd0fdc6e..7c471276 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -28,7 +28,7 @@ def build_environment(): def write_inx_file(name, contents): inx_file_name = "inkstitch_%s_%s.inx" % (name, current_locale) with open(os.path.join(inx_path, inx_file_name), 'w') as inx_file: - print >> inx_file.encode("utf-8"), contents + print >> inx_file, contents.encode("utf-8") def iterate_inx_locales(): global current_translation, current_locale diff --git a/messages.po b/messages.po index 074159c4..df36b6e9 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-20 20:42-0400\n" +"POT-Creation-Date: 2018-08-22 14:12-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -454,7 +454,7 @@ msgstr "" msgid "Installation Completed" msgstr "" -#: lib/extensions/install.py:103 +#: lib/extensions/install.py:107 msgid "Ink/Stitch Add-ons Installer" msgstr "" -- cgit v1.2.3 From 4e15a2ead213ebcf1e52347e1a94eadf18481286 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 22 Aug 2018 14:16:33 -0400 Subject: add context for 'English' translation string --- messages.po | 7 +++++-- templates/embroider.inx | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/messages.po b/messages.po index df36b6e9..093e0e35 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-22 14:12-0400\n" +"POT-Creation-Date: 2018-08-22 14:16-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1113,7 +1113,10 @@ msgstr "" msgid "Convert Line to Satin" msgstr "" -#: templates/convert_to_satin.inx:12 templates/embroider.inx:23 +#. This is used for the submenu under Extensions -> Ink/Stitch. Translate this +#. to your language's word for its language, e.g. "Español" for the spanish +#. translation. +#: templates/convert_to_satin.inx:12 templates/embroider.inx:24 #: templates/flip.inx:12 templates/install.inx:12 #: templates/layer_commands.inx:16 templates/object_commands.inx:14 #: templates/params.inx:12 templates/print.inx:12 templates/simulate.inx:12 diff --git a/templates/embroider.inx b/templates/embroider.inx index d89b4d6f..54f3be1b 100644 --- a/templates/embroider.inx +++ b/templates/embroider.inx @@ -20,6 +20,7 @@ all + {# L10N This is used for the submenu under Extensions -> Ink/Stitch. Translate this to your language's word for its language, e.g. "Español" for the spanish translation. #} -- 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(-) 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 d2f16f0666e4e294b5050a5e70449da8c23b9ea2 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Thu, 23 Aug 2018 20:53:30 -0400 Subject: fix layer and object commands templates --- messages.po | 4 ++-- templates/layer_commands.inx | 4 ++-- templates/object_commands.inx | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/messages.po b/messages.po index 093e0e35..cbb660de 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-22 14:16-0400\n" +"POT-Creation-Date: 2018-08-23 20:56-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1118,7 +1118,7 @@ msgstr "" #. translation. #: templates/convert_to_satin.inx:12 templates/embroider.inx:24 #: templates/flip.inx:12 templates/install.inx:12 -#: templates/layer_commands.inx:16 templates/object_commands.inx:14 +#: templates/layer_commands.inx:16 templates/object_commands.inx:15 #: templates/params.inx:12 templates/print.inx:12 templates/simulate.inx:12 msgid "English" msgstr "" diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx index 17eb3d83..a6c0283c 100644 --- a/templates/layer_commands.inx +++ b/templates/layer_commands.inx @@ -11,11 +11,11 @@ layer_commands all - + - +