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 --- bin/gen-input-inx | 36 ------------------------------------ bin/gen-output-format-option-list | 14 -------------- bin/gen-output-inx | 36 ------------------------------------ bin/gen-zip-inx | 35 ----------------------------------- bin/generate-inx-files | 10 ++++++++++ 5 files changed, 10 insertions(+), 121 deletions(-) delete mode 100755 bin/gen-input-inx delete mode 100755 bin/gen-output-format-option-list delete mode 100755 bin/gen-output-inx delete mode 100755 bin/gen-zip-inx create mode 100755 bin/generate-inx-files (limited to 'bin') diff --git a/bin/gen-input-inx b/bin/gen-input-inx deleted file mode 100755 index ae32b43f..00000000 --- a/bin/gen-input-inx +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python - -import sys, os -from os.path import dirname -import pyembroidery -from jinja2 import Environment, FileSystemLoader, select_autoescape - - -def build_environment(): - template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates") - - return Environment( - loader = FileSystemLoader(template_dir), - autoescape = True - ) - - -def pyembroidery_input_formats(): - for format in pyembroidery.supported_formats(): - if 'reader' in format and format['category'] == 'embroidery': - yield format['extension'], format['description'] - - -def main(): - env = build_environment() - template = env.get_template('embroider_input.inx') - - for format, description in pyembroidery_input_formats(): - inx = template.render(format=format, description=description) - - with open("inx/inkstitch_input_%s.inx" % format.upper(), 'w') as inx_file: - print >> inx_file, inx - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/bin/gen-output-format-option-list b/bin/gen-output-format-option-list deleted file mode 100755 index 28a83976..00000000 --- a/bin/gen-output-format-option-list +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python - -import sys -import pyembroidery - -formats = [format for format in pyembroidery.supported_formats() if 'writer' in format] -formats.sort(key=lambda format: (format['category'] != 'embroidery', format['extension'])) - -for format in formats: - tag = "" - if format['category'] != 'embroidery': - tag = " [DEBUG]" - - print '<_option value="%s">%s(%s)%s' % (format['extension'], format['description'], format['extension'].upper(), tag) diff --git a/bin/gen-output-inx b/bin/gen-output-inx deleted file mode 100755 index fbe2ad55..00000000 --- a/bin/gen-output-inx +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python - -import sys, os -from os.path import dirname -import pyembroidery -from jinja2 import Environment, FileSystemLoader, select_autoescape - - -def build_environment(): - template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates") - - return Environment( - loader = FileSystemLoader(template_dir), - autoescape = True - ) - - -def pyembroidery_output_formats(): - for format in pyembroidery.supported_formats(): - if 'writer' in format and format['category'] == 'embroidery': - yield format['extension'], format['description'] - - -def main(): - env = build_environment() - template = env.get_template('embroider_output.inx') - - for format, description in pyembroidery_output_formats(): - inx = template.render(format=format, description=description) - - with open("inx/inkstitch_output_%s.inx" % format.upper(), 'w') as inx_file: - print >> inx_file, inx - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx deleted file mode 100755 index 40948786..00000000 --- a/bin/gen-zip-inx +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -import sys, os -from os.path import dirname -import pyembroidery -from jinja2 import Environment, FileSystemLoader, select_autoescape - - -def build_environment(): - template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates") - - return Environment( - loader = FileSystemLoader(template_dir), - autoescape = True - ) - - -def pyembroidery_output_formats(): - for format in pyembroidery.supported_formats(): - if 'writer' in format and format['category'] == 'embroidery': - yield format['extension'], format['description'] - - -def main(): - env = build_environment() - template = env.get_template('embroider_zip_output.inx') - - inx = template.render(formats=pyembroidery_output_formats()) - - with open("inx/inkstitch_output_ZIP.inx", 'w') as inx_file: - inx_file.write(inx) - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/bin/generate-inx-files b/bin/generate-inx-files new file mode 100755 index 00000000..f7b7a801 --- /dev/null +++ b/bin/generate-inx-files @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import sys +import os +from os.path import dirname + +sys.path.append(os.path.join(dirname(dirname(__file__)))) +from lib.inx import generate_inx_files + +generate_inx_files() -- cgit v1.3.1 From 5a889dbfdaa470392d39354c44e7685c055fd33d Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 19 Aug 2018 22:21:28 -0400 Subject: make it easier to find inkex.py --- .travis.yml | 3 ++- bin/build-dist | 2 +- bin/generate-inx-files | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/.travis.yml b/.travis.yml index a3f6360b..d999f238 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,8 @@ install: if [ -n "$BUILD" ]; then # Need this for inkex.py and friends wget -q https://inkscape.org/en/gallery/item/12187/inkscape-0.92.3.tar.bz2 - tar jxf inkscape-0.92.3.tar.bz2 + mkdir inkscape + (cd inkscape; tar jxf --strip-components=1 inkscape-0.92.3.tar.bz2) rm inkscape-0.92.3.tar.bz2 fi if [ "$BUILD" = "linux" ]; then diff --git a/bin/build-dist b/bin/build-dist index a96b7506..c740c782 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -29,7 +29,7 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then fi # This lets pyinstaller see inkex.py, etc. -pyinstaller_args+="-p inkscape-0.92.3/share/extensions " +pyinstaller_args+="-p inkscape/share/extensions " # output useful debugging info that helps us trace library dependency issues pyinstaller_args+="--log-level DEBUG " diff --git a/bin/generate-inx-files b/bin/generate-inx-files index f7b7a801..a16fb32e 100755 --- a/bin/generate-inx-files +++ b/bin/generate-inx-files @@ -4,7 +4,14 @@ import sys import os from os.path import dirname -sys.path.append(os.path.join(dirname(dirname(__file__)))) +# add inkstitch libs to python path +parent_dir = os.path.join(dirname(dirname(__file__))) +sys.path.append(parent_dir) + +# try find add inkex.py et al. as well +sys.path.append(os.path.join(parent_dir, "inkscape", "share", "extensions")) +sys.path.append(os.path.join("/usr/share/inkscape/extensions")) + from lib.inx import generate_inx_files generate_inx_files() -- cgit v1.3.1 From f7f59efd7d5117c6b9b43b100df5fe646ea46bc3 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 20 Aug 2018 15:17:55 -0400 Subject: gettextify pyembroidery format descriptions --- Makefile | 2 + bin/pyembroidery-gettext | 10 +++ messages.po | 161 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100755 bin/pyembroidery-gettext (limited to 'bin') diff --git a/Makefile b/Makefile index 1cc223e4..a91eabe1 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,9 @@ inx: .PHONY: messages.po messages.po: rm -f messages.po + bin/pyembroidery-gettext > pyembroidery-format-descriptions.py pybabel extract -o messages.po -F babel.conf --add-location=full --add-comments=l10n,L10n,L10N --sort-by-file --strip-comments . + rm pyembroidery-format-descriptions.py .PHONY: locales locales: diff --git a/bin/pyembroidery-gettext b/bin/pyembroidery-gettext new file mode 100755 index 00000000..ac9bd1ab --- /dev/null +++ b/bin/pyembroidery-gettext @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import pyembroidery + + +# generate fake python code containing the descriptions of pyembroidery formats +# as gettext calls so that pybabel will extract them into messages.po +for format in pyembroidery.supported_formats(): + print "# L10N description for pyembroidery file format: %s" % format['extension'] + print "_(%s)" % repr(format['description']) diff --git a/messages.po b/messages.po index 5de56d8f..cfe111bc 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-19 22:14-0400\n" +"POT-Creation-Date: 2018-08-20 15:17-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -943,3 +943,162 @@ msgstr "" msgid "Realistic" msgstr "" +#. description for pyembroidery file format: pec +#. description for pyembroidery file format: pes +#. description for pyembroidery file format: phb +#. description for pyembroidery file format: phc +#: pyembroidery-format-descriptions.py:2 pyembroidery-format-descriptions.py:4 +#: pyembroidery-format-descriptions.py:56 +#: pyembroidery-format-descriptions.py:58 +msgid "Brother Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: exp +#: pyembroidery-format-descriptions.py:6 +msgid "Melco Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: dst +#. description for pyembroidery file format: tbf +#: pyembroidery-format-descriptions.py:8 pyembroidery-format-descriptions.py:48 +msgid "Tajima Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: jef +#. description for pyembroidery file format: sew +#. description for pyembroidery file format: jpx +#: pyembroidery-format-descriptions.py:10 +#: pyembroidery-format-descriptions.py:20 +#: pyembroidery-format-descriptions.py:74 +msgid "Janome Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: vp3 +#. description for pyembroidery file format: ksm +#. description for pyembroidery file format: max +#. description for pyembroidery file format: pcd +#. description for pyembroidery file format: pcq +#. description for pyembroidery file format: pcm +#. description for pyembroidery file format: pcs +#: pyembroidery-format-descriptions.py:12 +#: pyembroidery-format-descriptions.py:50 +#: pyembroidery-format-descriptions.py:62 +#: pyembroidery-format-descriptions.py:66 +#: pyembroidery-format-descriptions.py:68 +#: pyembroidery-format-descriptions.py:70 +#: pyembroidery-format-descriptions.py:72 +msgid "Pfaff Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: svg +#: pyembroidery-format-descriptions.py:14 +msgid "Scalable Vector Graphics" +msgstr "" + +#. description for pyembroidery file format: csv +#: pyembroidery-format-descriptions.py:16 +msgid "Comma-separated values" +msgstr "" + +#. description for pyembroidery file format: xxx +#: pyembroidery-format-descriptions.py:18 +msgid "Singer Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: u01 +#: pyembroidery-format-descriptions.py:22 +msgid "Barudan Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: shv +#: pyembroidery-format-descriptions.py:24 +msgid "Husqvarna Viking Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: 10o +#. description for pyembroidery file format: 100 +#: pyembroidery-format-descriptions.py:26 +#: pyembroidery-format-descriptions.py:28 +msgid "Toyota Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: bro +#: pyembroidery-format-descriptions.py:30 +msgid "Bits & Volts Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: dat +#: pyembroidery-format-descriptions.py:32 +msgid "Sunstar or Barudan Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: dsb +#: pyembroidery-format-descriptions.py:34 +msgid "Tajima(Barudan) Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: dsz +#: pyembroidery-format-descriptions.py:36 +msgid "ZSK USA Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: emd +#: pyembroidery-format-descriptions.py:38 +msgid "Elna Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: exy +#: pyembroidery-format-descriptions.py:40 +msgid "Eltac Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: fxy +#: pyembroidery-format-descriptions.py:42 +msgid "Fortron Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: gt +#: pyembroidery-format-descriptions.py:44 +msgid "Gold Thread Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: inb +#: pyembroidery-format-descriptions.py:46 +msgid "Inbro Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: tap +#: pyembroidery-format-descriptions.py:52 +msgid "Happy Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: stx +#: pyembroidery-format-descriptions.py:54 +msgid "Data Stitch Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: new +#: pyembroidery-format-descriptions.py:60 +msgid "Ameco Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: mit +#: pyembroidery-format-descriptions.py:64 +msgid "Mitsubishi Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: stc +#: pyembroidery-format-descriptions.py:76 +msgid "Gunold Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: zxy +#: pyembroidery-format-descriptions.py:78 +msgid "ZSK TC Embroidery Format" +msgstr "" + +#. description for pyembroidery file format: pmv +#: pyembroidery-format-descriptions.py:80 +msgid "Brother Stitch Format" +msgstr "" + -- cgit v1.3.1