diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/extensions/__init__.py | 21 | ||||
| -rw-r--r-- | lib/extensions/install.py | 4 | ||||
| -rwxr-xr-x | lib/inx/extensions.py | 16 | ||||
| -rw-r--r-- | lib/inx/utils.py | 2 |
4 files changed, 32 insertions, 11 deletions
diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index b865db4c..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 314843f4..6c179beb 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -95,6 +95,10 @@ class InstallerFrame(wx.Frame): 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/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())) diff --git a/lib/inx/utils.py b/lib/inx/utils.py index 8dd3fdf8..54b37c58 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -30,7 +30,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, contents.encode("utf-8") def iterate_inx_locales(): |
