summaryrefslogtreecommitdiff
path: root/lib/inx
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-08-24 20:46:10 -0400
committerLex Neva <github.com@lexneva.name>2018-08-24 20:46:10 -0400
commit91eb98cc33602f19dddc186c034aed968e048404 (patch)
tree1bd891b97f8447cb3f513d073d20cea5d4534461 /lib/inx
parentadc0e3e43bb83f4608317293537309d8a53a496e (diff)
parentb3bb975401fe4971170239eea9b928ee13161398 (diff)
Merge remote-tracking branch 'origin/master' into lexelby/style
Diffstat (limited to 'lib/inx')
-rwxr-xr-xlib/inx/extensions.py16
-rw-r--r--lib/inx/utils.py2
2 files changed, 16 insertions, 2 deletions
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():