diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-08-21 16:45:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-21 16:45:13 -0400 |
| commit | afb886cbe04d19c6b7d1886dfc2c6052646a2dbf (patch) | |
| tree | 2d0a6fe95a26d5b934fe893f3d2b3e94b2aadcc8 | |
| parent | 8116f32068a4fe55e7f30ca2a369b2443d89b560 (diff) | |
| parent | 8f700007fc7d3b7866d4e4a3dac6a36bb3e1be2a (diff) | |
Merge pull request #286 from inkstitch/lexelby/i18n-revamp
localize INX files
70 files changed, 1002 insertions, 757 deletions
@@ -7,3 +7,4 @@ dist/ build/ locales/ +/inx/ diff --git a/.travis.yml b/.travis.yml index a3f6360b..ccacede3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,20 +14,26 @@ matrix: - python: 2.7 env: LINT=true sudo: false + if: type != cron - python: 2.7 sudo: required env: BUILD=linux - if: tag =~ ^v[0-9.]+$ OR branch != master + if: type != cron AND (tag =~ ^v[0-9.]+$ OR branch != master) - python: 2.7 sudo: required env: BUILD=windows - if: tag =~ ^v[0-9.]+$ OR branch != master + if: type != cron AND (tag =~ ^v[0-9.]+$ OR branch != master) - language: generic os: osx sudo: required env: BUILD=osx - if: tag =~ ^v[0-9.]+$ OR branch != master + if: type != cron AND (tag =~ ^v[0-9.]+$ OR branch != master) + + - language: java + sudo: false + env: CROWDIN=true + if: type = cron branches: except: - /^dev-build-/ @@ -38,8 +44,9 @@ 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 + tar -jxf inkscape-0.92.3.tar.bz2 rm inkscape-0.92.3.tar.bz2 + mv inkscape-0.92.3 inkscape fi if [ "$BUILD" = "linux" ]; then # For some bizarre reason, this build has been failing due to the @@ -145,6 +152,21 @@ script: # work around some bug... pyinstaller? shapely? not sure. cp $(winepath 'C:\Python\lib\site-packages\shapely\DLLs\geos_c.dll') $(winepath 'C:\Python\lib\site-packages\shapely\DLLs\geos.dll') make dist + elif [ -n "$CROWDIN" ]; then + git config --global user.email "inkstitch-crowdin@lex.gd" + git config --global user.name "Ink/Stitch Crowdin integration" + + wget https://crowdin.com/downloads/crowdin-cli.jar + java -jar crowdin-cli.jar pull -b master + + # Try to only commit if translations changed. Crowdin will update all + # files when a new translation string is added but we don't need to + # commit those until folks actually translate the new strings. + if git diff translations | grep -qE '^[-+]msgstr ".+"$'; then + git add translations + git commit -m "new translations from Crowdin" + git push https://${TRAVIS_REPO_SLUG%/*}:${GITHUB_API_KEY}@github.com/${TRAVIS_REPO_SLUG}.git master + fi else true fi @@ -5,7 +5,7 @@ VERSION:=$(subst /,-,$(TRAVIS_BRANCH)) OS:=$(TRAVIS_OS_NAME) ARCH:=$(shell uname -m) -dist: distclean locales +dist: distclean locales inx bin/build-dist $(EXTENSIONS) cp inx/*.inx dist cp -a images/examples dist/inkstitch @@ -23,11 +23,22 @@ dist: distclean locales distclean: rm -rf build dist *.spec *.tar.gz +.PHONY: inx +inx: locales + mkdir -p inx + if [ "$$BUILD" = "windows" ]; then \ + wine c:\\Python\\python.exe bin/generate-inx-files; \ + else \ + bin/generate-inx-files; \ + fi + +.PHONY: messages.po messages.po: rm -f messages.po - pybabel extract -o messages.po -F babel.conf --add-location=full --add-comments=l10n,L10n,L10N --sort-by-file --strip-comments . + 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 -k N_ . + rm pyembroidery-format-descriptions.py -.PHONY: messages.po .PHONY: locales locales: # message files will look like this: @@ -3,4 +3,4 @@ [python: **.py] [jinja2: print/templates/*.html] - +[jinja2: templates/*] 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/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</_option>' % (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..a16fb32e --- /dev/null +++ b/bin/generate-inx-files @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import sys +import os +from os.path import dirname + +# 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() 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/crowdin.yml b/crowdin.yml index be40a011..d806d82e 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,5 @@ +project_identifier: inkstitch +api_key_env: CROWDIN_API_KEY files: - source: messages.po translation: /translations/messages_%locale_with_underscore%.po diff --git a/inx/inkstitch_attach_commands.inx b/inx/inkstitch_attach_commands.inx deleted file mode 100644 index 61cf7213..00000000 --- a/inx/inkstitch_attach_commands.inx +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Attach Commands</_name> - <id>org.inkstitch.commands</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="fill_start" type="boolean" _gui-text="Fill starting position">false</param> - <param name="fill_end" type="boolean" _gui-text="Fill ending position">false</param> - <param name="stop" type="boolean" _gui-text="Stop after sewing this object">false</param> - <param name="trim" type="boolean" _gui-text="Trim thread after sewing this object">false</param> - <param name="ignore_object" type="boolean" _gui-text="Ignore this object (do not stitch)">false</param> - <param name="extension" type="string" gui-hidden="true">object_commands</param> - <effect> - <object-type>all</object-type> - <effects-menu> - <submenu _name="Embroidery" /> - </effects-menu> - </effect> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_embroider.inx b/inx/inkstitch_embroider.inx deleted file mode 100644 index 70bc10b0..00000000 --- a/inx/inkstitch_embroider.inx +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Embroider</_name> - <id>jonh.embroider</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="collapse_len_mm" type="float" min="0.0" max="10.0" _gui-text="Collapse length (mm)" _gui-description="Jump stitches smaller than this will be treated as normal stitches.">3.0</param> - <param name="hide_layers" type="boolean" _gui-text="Hide other layers" _gui-description="Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernable.">true</param> - <param name="output_format" type="optiongroup" _gui-text="Output file format" appearance="minimal"> - <_option value="dst">Tajima Embroidery Format (DST)</_option> - <_option value="exp">Melco Embroidery Format (EXP)</_option> - <_option value="jef">Janome Embroidery Format (JEF)</_option> - <_option value="pec">Brother Embroidery Format (PEC)</_option> - <_option value="pes">Brother Embroidery Format (PES)</_option> - <_option value="vp3">Pfaff Embroidery Format (VP3)</_option> - <_option value="csv">Comma-separated values (CSV) [DEBUG]</_option> - <_option value="svg">Scalable Vector Graphics (SVG) [DEBUG]</_option> - </param> - <param name="path" type="string" _gui-text="Directory" _gui-description="Leave empty to save the output in Inkscape's extension directory."></param> - <param name="extension" type="string" gui-hidden="true">embroider</param> - <effect> - <object-type>all</object-type> - <effects-menu> - <submenu _name="Embroidery"/> - </effects-menu> - </effect> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_100.inx b/inx/inkstitch_input_100.inx deleted file mode 100644 index def2011d..00000000 --- a/inx/inkstitch_input_100.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>100 file input</_name> - <id>org.inkstitch.input.100</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.100</extension> - <mimetype>application/x-embroidery-100</mimetype> - <_filetypename>Ink/Stitch: Toyota Embroidery Format (.100)</_filetypename> - <_filetypetooltip>convert 100 file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_10O.inx b/inx/inkstitch_input_10O.inx deleted file mode 100644 index 29b14397..00000000 --- a/inx/inkstitch_input_10O.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>10O file input</_name> - <id>org.inkstitch.input.10o</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.10o</extension> - <mimetype>application/x-embroidery-10o</mimetype> - <_filetypename>Ink/Stitch: Toyota Embroidery Format (.10o)</_filetypename> - <_filetypetooltip>convert 10O file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_BRO.inx b/inx/inkstitch_input_BRO.inx deleted file mode 100644 index 928195a6..00000000 --- a/inx/inkstitch_input_BRO.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>BRO file input</_name> - <id>org.inkstitch.input.bro</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.bro</extension> - <mimetype>application/x-embroidery-bro</mimetype> - <_filetypename>Ink/Stitch: Bits & Volts Embroidery Format (.bro)</_filetypename> - <_filetypetooltip>convert BRO file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_DSB.inx b/inx/inkstitch_input_DSB.inx deleted file mode 100644 index c78e1c2d..00000000 --- a/inx/inkstitch_input_DSB.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>DSB file input</_name> - <id>org.inkstitch.input.dsb</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.dsb</extension> - <mimetype>application/x-embroidery-dsb</mimetype> - <_filetypename>Ink/Stitch: Tajima(Barudan) Embroidery Format (.dsb)</_filetypename> - <_filetypetooltip>convert DSB file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_DST.inx b/inx/inkstitch_input_DST.inx deleted file mode 100644 index b3eee601..00000000 --- a/inx/inkstitch_input_DST.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>DST file input</_name> - <id>org.inkstitch.input.dst</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.dst</extension> - <mimetype>application/x-embroidery-dst</mimetype> - <_filetypename>Ink/Stitch: Tajima Embroidery Format (.dst)</_filetypename> - <_filetypetooltip>convert DST file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_DSZ.inx b/inx/inkstitch_input_DSZ.inx deleted file mode 100644 index 388aeda0..00000000 --- a/inx/inkstitch_input_DSZ.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>DSZ file input</_name> - <id>org.inkstitch.input.dsz</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.dsz</extension> - <mimetype>application/x-embroidery-dsz</mimetype> - <_filetypename>Ink/Stitch: ZSK USA Embroidery Format (.dsz)</_filetypename> - <_filetypetooltip>convert DSZ file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_EMD.inx b/inx/inkstitch_input_EMD.inx deleted file mode 100644 index c05da24f..00000000 --- a/inx/inkstitch_input_EMD.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>EMD file input</_name> - <id>org.inkstitch.input.emd</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.emd</extension> - <mimetype>application/x-embroidery-emd</mimetype> - <_filetypename>Ink/Stitch: Elna Embroidery Format (.emd)</_filetypename> - <_filetypetooltip>convert EMD file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_EXP.inx b/inx/inkstitch_input_EXP.inx deleted file mode 100644 index 2c5997d5..00000000 --- a/inx/inkstitch_input_EXP.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>EXP file input</_name> - <id>org.inkstitch.input.exp</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.exp</extension> - <mimetype>application/x-embroidery-exp</mimetype> - <_filetypename>Ink/Stitch: Melco Embroidery Format (.exp)</_filetypename> - <_filetypetooltip>convert EXP file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_INB.inx b/inx/inkstitch_input_INB.inx deleted file mode 100644 index 7409a853..00000000 --- a/inx/inkstitch_input_INB.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>INB file input</_name> - <id>org.inkstitch.input.inb</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.inb</extension> - <mimetype>application/x-embroidery-inb</mimetype> - <_filetypename>Ink/Stitch: Inbro Embroidery Format (.inb)</_filetypename> - <_filetypetooltip>convert INB file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_JEF.inx b/inx/inkstitch_input_JEF.inx deleted file mode 100644 index 364e969f..00000000 --- a/inx/inkstitch_input_JEF.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>JEF file input</_name> - <id>org.inkstitch.input.jef</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.jef</extension> - <mimetype>application/x-embroidery-jef</mimetype> - <_filetypename>Ink/Stitch: Janome Embroidery Format (.jef)</_filetypename> - <_filetypetooltip>convert JEF file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_KSM.inx b/inx/inkstitch_input_KSM.inx deleted file mode 100644 index b01eb195..00000000 --- a/inx/inkstitch_input_KSM.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>KSM file input</_name> - <id>org.inkstitch.input.ksm</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.ksm</extension> - <mimetype>application/x-embroidery-ksm</mimetype> - <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.ksm)</_filetypename> - <_filetypetooltip>convert KSM file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_PEC.inx b/inx/inkstitch_input_PEC.inx deleted file mode 100644 index 885c0125..00000000 --- a/inx/inkstitch_input_PEC.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>PEC file input</_name> - <id>org.inkstitch.input.pec</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.pec</extension> - <mimetype>application/x-embroidery-pec</mimetype> - <_filetypename>Ink/Stitch: Brother Embroidery Format (.pec)</_filetypename> - <_filetypetooltip>convert PEC file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_PES.inx b/inx/inkstitch_input_PES.inx deleted file mode 100644 index 6faa06be..00000000 --- a/inx/inkstitch_input_PES.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>PES file input</_name> - <id>org.inkstitch.input.pes</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.pes</extension> - <mimetype>application/x-embroidery-pes</mimetype> - <_filetypename>Ink/Stitch: Brother Embroidery Format (.pes)</_filetypename> - <_filetypetooltip>convert PES file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_SEW.inx b/inx/inkstitch_input_SEW.inx deleted file mode 100644 index a7661c97..00000000 --- a/inx/inkstitch_input_SEW.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>SEW file input</_name> - <id>org.inkstitch.input.sew</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.sew</extension> - <mimetype>application/x-embroidery-sew</mimetype> - <_filetypename>Ink/Stitch: Janome Embroidery Format (.sew)</_filetypename> - <_filetypetooltip>convert SEW file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_SHV.inx b/inx/inkstitch_input_SHV.inx deleted file mode 100644 index 7aad470c..00000000 --- a/inx/inkstitch_input_SHV.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>SHV file input</_name> - <id>org.inkstitch.input.shv</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.shv</extension> - <mimetype>application/x-embroidery-shv</mimetype> - <_filetypename>Ink/Stitch: Husqvarna Viking Embroidery Format (.shv)</_filetypename> - <_filetypetooltip>convert SHV file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_STX.inx b/inx/inkstitch_input_STX.inx deleted file mode 100644 index 3f1a3065..00000000 --- a/inx/inkstitch_input_STX.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>STX file input</_name> - <id>org.inkstitch.input.stx</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.stx</extension> - <mimetype>application/x-embroidery-stx</mimetype> - <_filetypename>Ink/Stitch: Data Stitch Embroidery Format (.stx)</_filetypename> - <_filetypetooltip>convert STX file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_TAP.inx b/inx/inkstitch_input_TAP.inx deleted file mode 100644 index bf299130..00000000 --- a/inx/inkstitch_input_TAP.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>TAP file input</_name> - <id>org.inkstitch.input.tap</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.tap</extension> - <mimetype>application/x-embroidery-tap</mimetype> - <_filetypename>Ink/Stitch: Happy Embroidery Format (.tap)</_filetypename> - <_filetypetooltip>convert TAP file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_TBF.inx b/inx/inkstitch_input_TBF.inx deleted file mode 100644 index e2b72ec9..00000000 --- a/inx/inkstitch_input_TBF.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>TBF file input</_name> - <id>org.inkstitch.input.tbf</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.tbf</extension> - <mimetype>application/x-embroidery-tbf</mimetype> - <_filetypename>Ink/Stitch: Tajima Embroidery Format (.tbf)</_filetypename> - <_filetypetooltip>convert TBF file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_U01.inx b/inx/inkstitch_input_U01.inx deleted file mode 100644 index befadd5b..00000000 --- a/inx/inkstitch_input_U01.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>U01 file input</_name> - <id>org.inkstitch.input.u01</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.u01</extension> - <mimetype>application/x-embroidery-u01</mimetype> - <_filetypename>Ink/Stitch: Barudan Embroidery Format (.u01)</_filetypename> - <_filetypetooltip>convert U01 file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_VP3.inx b/inx/inkstitch_input_VP3.inx deleted file mode 100644 index b39f630a..00000000 --- a/inx/inkstitch_input_VP3.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>VP3 file input</_name> - <id>org.inkstitch.input.vp3</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.vp3</extension> - <mimetype>application/x-embroidery-vp3</mimetype> - <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.vp3)</_filetypename> - <_filetypetooltip>convert VP3 file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_input_XXX.inx b/inx/inkstitch_input_XXX.inx deleted file mode 100644 index 6e8e501e..00000000 --- a/inx/inkstitch_input_XXX.inx +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>XXX file input</_name> - <id>org.inkstitch.input.xxx</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <input> - <extension>.xxx</extension> - <mimetype>application/x-embroidery-xxx</mimetype> - <_filetypename>Ink/Stitch: Singer Embroidery Format (.xxx)</_filetypename> - <_filetypetooltip>convert XXX file to Ink/Stitch manual-stitch paths</_filetypetooltip> - </input> - <param name="extension" type="string" gui-hidden="true">input</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_layer_commands.inx b/inx/inkstitch_layer_commands.inx deleted file mode 100644 index 7eadd094..00000000 --- a/inx/inkstitch_layer_commands.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Add Layer Commands</_name> - <id>org.inkstitch.layer_commands</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="description" type="description">Commands will be added to the currently-selected layer.</param> - <param name="ignore_layer" type="boolean" _gui-text="Ignore layer (do not stitch any objects in this layer)">false</param> - <param name="extension" type="string" gui-hidden="true">layer_commands</param> - <effect> - <object-type>all</object-type> - <effects-menu> - <submenu _name="Embroidery" /> - </effects-menu> - </effect> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_DST.inx b/inx/inkstitch_output_DST.inx deleted file mode 100644 index fa034f40..00000000 --- a/inx/inkstitch_output_DST.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>DST file output</_name> - <id>org.inkstitch.output.dst</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.dst</extension> - <mimetype>application/x-embroidery-dst</mimetype> - <_filetypename>Ink/Stitch: Tajima Embroidery Format (.dst)</_filetypename> - <_filetypetooltip>Save design in DST format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">dst</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_EXP.inx b/inx/inkstitch_output_EXP.inx deleted file mode 100644 index 853bab9f..00000000 --- a/inx/inkstitch_output_EXP.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>EXP file output</_name> - <id>org.inkstitch.output.exp</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.exp</extension> - <mimetype>application/x-embroidery-exp</mimetype> - <_filetypename>Ink/Stitch: Melco Embroidery Format (.exp)</_filetypename> - <_filetypetooltip>Save design in EXP format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">exp</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_JEF.inx b/inx/inkstitch_output_JEF.inx deleted file mode 100644 index 74b752fc..00000000 --- a/inx/inkstitch_output_JEF.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>JEF file output</_name> - <id>org.inkstitch.output.jef</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.jef</extension> - <mimetype>application/x-embroidery-jef</mimetype> - <_filetypename>Ink/Stitch: Janome Embroidery Format (.jef)</_filetypename> - <_filetypetooltip>Save design in JEF format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">jef</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_PEC.inx b/inx/inkstitch_output_PEC.inx deleted file mode 100644 index 6d76b165..00000000 --- a/inx/inkstitch_output_PEC.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>PEC file output</_name> - <id>org.inkstitch.output.pec</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.pec</extension> - <mimetype>application/x-embroidery-pec</mimetype> - <_filetypename>Ink/Stitch: Brother Embroidery Format (.pec)</_filetypename> - <_filetypetooltip>Save design in PEC format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">pec</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_PES.inx b/inx/inkstitch_output_PES.inx deleted file mode 100644 index b821225a..00000000 --- a/inx/inkstitch_output_PES.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>PES file output</_name> - <id>org.inkstitch.output.pes</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.pes</extension> - <mimetype>application/x-embroidery-pes</mimetype> - <_filetypename>Ink/Stitch: Brother Embroidery Format (.pes)</_filetypename> - <_filetypetooltip>Save design in PES format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">pes</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_VP3.inx b/inx/inkstitch_output_VP3.inx deleted file mode 100644 index 11843420..00000000 --- a/inx/inkstitch_output_VP3.inx +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>VP3 file output</_name> - <id>org.inkstitch.output.vp3</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.vp3</extension> - <mimetype>application/x-embroidery-vp3</mimetype> - <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.vp3)</_filetypename> - <_filetypetooltip>Save design in VP3 format using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - <param name="extension" type="string" gui-hidden="true">output</param> - <param name="format" type="string" gui-hidden="true">vp3</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension> diff --git a/inx/inkstitch_output_ZIP.inx b/inx/inkstitch_output_ZIP.inx deleted file mode 100644 index 81f17b23..00000000 --- a/inx/inkstitch_output_ZIP.inx +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>embroidery ZIP file output</_name> - <id>org.inkstitch.output.zip</id> - <dependency type="executable" location="extensions">inkstitch.py</dependency> - <dependency type="executable" location="extensions">inkex.py</dependency> - <output> - <extension>.zip</extension> - <mimetype>application/zip</mimetype> - <_filetypename>Ink/Stitch: ZIP export multiple formats (.zip)</_filetypename> - <_filetypetooltip>Create a ZIP with multiple embroidery file formats using Ink/Stitch</_filetypetooltip> - <dataloss>true</dataloss> - </output> - - <param name="format-pec" type="boolean" _gui-text=".PEC: Brother Embroidery Format">false</param> - - <param name="format-pes" type="boolean" _gui-text=".PES: Brother Embroidery Format">false</param> - - <param name="format-exp" type="boolean" _gui-text=".EXP: Melco Embroidery Format">false</param> - - <param name="format-dst" type="boolean" _gui-text=".DST: Tajima Embroidery Format">false</param> - - <param name="format-jef" type="boolean" _gui-text=".JEF: Janome Embroidery Format">false</param> - - <param name="format-vp3" type="boolean" _gui-text=".VP3: Pfaff Embroidery Format">false</param> - - <param name="extension" type="string" gui-hidden="true">zip</param> - <script> - <command reldir="extensions" interpreter="python">inkstitch.py</command> - </script> -</inkscape-extension>
\ No newline at end of file diff --git a/lib/commands.py b/lib/commands.py index cadfa080..214b5f40 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -3,13 +3,42 @@ import cubicsuperpath from .svg import apply_transforms from .svg.tags import SVG_USE_TAG, SVG_SYMBOL_TAG, CONNECTION_START, CONNECTION_END, XLINK_HREF +from .utils import cache +from .i18n import _, N_ +COMMANDS = { + # L10N command attached to an object + "fill_start": N_("Fill stitch starting position"), + + # L10N command attached to an object + "fill_end": N_("Fill stitch ending position"), + + # L10N command attached to an object + "stop": N_("Stop (pause machine) after sewing this object"), + + # L10N command attached to an object + "trim": N_("Trim thread after sewing this object"), + + # L10N command attached to an object + "ignore_object": N_("Ignore this object (do not stitch)"), + + # L10N command that affects entire layer + "ignore_layer": N_("Ignore layer (do not stitch any objects in this layer)") +} + +OBJECT_COMMANDS = [ "fill_start", "fill_end", "stop", "trim", "ignore_object" ] +LAYER_COMMANDS = [ "ignore_layer" ] class CommandParseError(Exception): pass class BaseCommand(object): + @property + @cache + def description(self): + return get_command_description(self.command) + def parse_symbol(self): if self.symbol.tag != SVG_SYMBOL_TAG: raise CommandParseError("use points to non-symbol") @@ -87,6 +116,9 @@ class StandaloneCommand(BaseCommand): self.parse_symbol() +def get_command_description(command): + return _(COMMANDS[command]) + def find_commands(node): """Find the symbols this node is connected to and return them as Commands""" diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index 6c8db318..1606795c 100644 --- a/lib/extensions/__init__.py +++ b/lib/extensions/__init__.py @@ -10,3 +10,13 @@ from flip import Flip 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) diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 571e3c2d..1794b68c 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -3,6 +3,7 @@ import re import json from copy import deepcopy from collections import MutableMapping +from stringcase import snakecase from ..svg.tags import * from ..elements import AutoFill, Fill, Stroke, SatinColumn, Polyline, EmbroideryElement @@ -98,6 +99,10 @@ class InkStitchMetadata(MutableMapping): class InkstitchExtension(inkex.Effect): """Base class for Inkstitch extensions. Not intended for direct use.""" + @classmethod + def name(cls): + return snakecase(cls.__name__) + def hide_all_layers(self): for g in self.document.getroot().findall(SVG_GROUP_TAG): if g.get(INKSCAPE_GROUPMODE) == "layer": diff --git a/lib/extensions/layer_commands.py b/lib/extensions/layer_commands.py index 88170f66..576af044 100644 --- a/lib/extensions/layer_commands.py +++ b/lib/extensions/layer_commands.py @@ -3,13 +3,14 @@ import sys import inkex from .commands import CommandsExtension +from ..commands import LAYER_COMMANDS, get_command_description from ..i18n import _ -from ..svg.tags import SVG_USE_TAG, XLINK_HREF +from ..svg.tags import * from ..svg import get_correction_transform class LayerCommands(CommandsExtension): - COMMANDS = ["ignore_layer"] + COMMANDS = LAYER_COMMANDS def ensure_current_layer(self): # if no layer is selected, inkex defaults to the root, which isn't @@ -37,6 +38,7 @@ class LayerCommands(CommandsExtension): node = inkex.etree.SubElement(self.current_layer, SVG_USE_TAG, { "id": self.uniqueId("use"), + INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), XLINK_HREF: "#inkstitch_%s" % command, "height": "100%", "width": "100%", diff --git a/lib/extensions/object_commands.py b/lib/extensions/object_commands.py index 27a07969..e9ee6063 100644 --- a/lib/extensions/object_commands.py +++ b/lib/extensions/object_commands.py @@ -7,14 +7,15 @@ from random import random from shapely import geometry as shgeo from .commands import CommandsExtension +from ..commands import OBJECT_COMMANDS, get_command_description from ..i18n import _ from ..elements import SatinColumn -from ..svg.tags import SVG_GROUP_TAG, SVG_USE_TAG, SVG_PATH_TAG, INKSCAPE_GROUPMODE, XLINK_HREF, CONNECTION_START, CONNECTION_END, CONNECTOR_TYPE +from ..svg.tags import * from ..svg import get_correction_transform class ObjectCommands(CommandsExtension): - COMMANDS = ["fill_start", "fill_end", "stop", "trim", "ignore_object"] + COMMANDS = OBJECT_COMMANDS def add_connector(self, symbol, element): # I'd like it if I could position the connector endpoint nicely but inkscape just @@ -27,14 +28,16 @@ class ObjectCommands(CommandsExtension): "id": self.uniqueId("connector"), "d": "M %s,%s %s,%s" % (start_pos[0], start_pos[1], end_pos.x, end_pos.y), "style": "stroke:#000000;stroke-width:1px;stroke-opacity:0.5;fill:none;", - "transform": get_correction_transform(symbol), CONNECTION_START: "#%s" % symbol.get('id'), CONNECTION_END: "#%s" % element.node.get('id'), CONNECTOR_TYPE: "polyline", + + # l10n: the name of the line that connects a command to the object it applies to + INKSCAPE_LABEL: _("connector") } ) - symbol.getparent().insert(symbol.getparent().index(symbol), path) + symbol.getparent().insert(0, path) def get_command_pos(self, element, index, total): # Put command symbols 30 pixels out from the shape, spaced evenly around it. @@ -71,7 +74,15 @@ class ObjectCommands(CommandsExtension): pos = self.get_command_pos(element, i, len(commands)) - symbol = inkex.etree.SubElement(element.node.getparent(), SVG_USE_TAG, + group = inkex.etree.SubElement(element.node.getparent(), SVG_GROUP_TAG, + { + "id": self.uniqueId("group"), + INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), + "transform": get_correction_transform(element.node) + } + ) + + symbol = inkex.etree.SubElement(group, SVG_USE_TAG, { "id": self.uniqueId("use"), XLINK_HREF: "#inkstitch_%s" % command, @@ -79,7 +90,9 @@ class ObjectCommands(CommandsExtension): "width": "100%", "x": str(pos.x), "y": str(pos.y), - "transform": get_correction_transform(element.node) + + # l10n: the name of a command symbol (example: scissors icon for trim command) + INKSCAPE_LABEL: _("command marker"), } ) diff --git a/lib/i18n.py b/lib/i18n.py index d20f5d2f..419c03dc 100644 --- a/lib/i18n.py +++ b/lib/i18n.py @@ -1,21 +1,32 @@ import sys import os +from os.path import dirname, realpath import gettext _ = translation = None +locale_dir = None + +# Use N_ to mark a string for translation but _not_ immediately translate it. +# reference: https://docs.python.org/3/library/gettext.html#deferred-translations +# Makefile configures pybabel to treat N_() the same as _() +def N_(message): return message + +def _set_locale_dir(): + global locale_dir -def localize(): if getattr(sys, 'frozen', False): # we are in a pyinstaller installation locale_dir = sys._MEIPASS else: - locale_dir = os.path.dirname(__file__) + locale_dir = dirname(dirname(realpath(__file__))) locale_dir = os.path.join(locale_dir, 'locales') +def localize(languages=None): global translation, _ translation = gettext.translation("inkstitch", locale_dir, fallback=True) _ = translation.gettext +_set_locale_dir() localize() diff --git a/lib/inx/__init__.py b/lib/inx/__init__.py new file mode 100644 index 00000000..32b8bfae --- /dev/null +++ b/lib/inx/__init__.py @@ -0,0 +1 @@ +from generate import generate_inx_files diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py new file mode 100755 index 00000000..2b097440 --- /dev/null +++ b/lib/inx/extensions.py @@ -0,0 +1,24 @@ +import pyembroidery + +from .utils import build_environment, write_inx_file +from .outputs import pyembroidery_output_formats +from ..extensions import extensions, Input, Output + + +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: + 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(), + debug_formats=pyembroidery_debug_formats())) diff --git a/lib/inx/generate.py b/lib/inx/generate.py new file mode 100644 index 00000000..f9ed799b --- /dev/null +++ b/lib/inx/generate.py @@ -0,0 +1,12 @@ +import os + +from .inputs import generate_input_inx_files +from .outputs import generate_output_inx_files +from .extensions import generate_extension_inx_files +from .utils import iterate_inx_locales, inx_path + +def generate_inx_files(): + for locale in iterate_inx_locales(): + generate_input_inx_files() + generate_output_inx_files() + generate_extension_inx_files() diff --git a/lib/inx/inputs.py b/lib/inx/inputs.py new file mode 100755 index 00000000..d40ffeaf --- /dev/null +++ b/lib/inx/inputs.py @@ -0,0 +1,18 @@ +import pyembroidery + +from .utils import build_environment, write_inx_file + + +def pyembroidery_input_formats(): + for format in pyembroidery.supported_formats(): + if 'reader' in format and format['category'] == 'embroidery': + yield format['extension'], format['description'] + + +def generate_input_inx_files(): + env = build_environment() + template = env.get_template('input.inx') + + for format, description in pyembroidery_input_formats(): + name = "input_%s" % format.upper() + write_inx_file(name, template.render(format=format, description=description)) diff --git a/lib/inx/outputs.py b/lib/inx/outputs.py new file mode 100644 index 00000000..aef0c8b5 --- /dev/null +++ b/lib/inx/outputs.py @@ -0,0 +1,18 @@ +import pyembroidery + +from .utils import build_environment, write_inx_file + + +def pyembroidery_output_formats(): + for format in pyembroidery.supported_formats(): + if 'writer' in format and format['category'] == 'embroidery': + yield format['extension'], format['description'] + + +def generate_output_inx_files(): + env = build_environment() + template = env.get_template('output.inx') + + for format, description in pyembroidery_output_formats(): + name = "output_%s" % format.upper() + write_inx_file(name, template.render(format=format, description=description)) diff --git a/lib/inx/utils.py b/lib/inx/utils.py new file mode 100644 index 00000000..6103f360 --- /dev/null +++ b/lib/inx/utils.py @@ -0,0 +1,49 @@ +import os +import gettext +from os.path import dirname +from jinja2 import Environment, FileSystemLoader + +from ..i18n import translation as default_translation, locale_dir, _, N_ + + +_top_path = dirname(dirname(dirname(os.path.realpath(__file__)))) +inx_path = os.path.join(_top_path, "inx") +template_path = os.path.join(_top_path, "templates") + +current_translation = default_translation +current_locale = "en_US" + +def build_environment(): + env = Environment( + loader = FileSystemLoader(template_path), + autoescape = True, + extensions=['jinja2.ext.i18n'] + ) + + env.install_gettext_translations(current_translation) + env.globals["locale"] = current_locale + + return env + +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 + +def iterate_inx_locales(): + global current_translation, current_locale + + locales = sorted(os.listdir(locale_dir)) + for locale in locales: + translation = gettext.translation("inkstitch", locale_dir, languages=[locale], fallback=True) + + # L10N If you translate this string, that will tell Ink/Stitch to + # generate menu items for this language in Inkscape's "Extensions" + # menu. + magic_string = N_("Generate INX files") + translated_magic_string = translation.gettext(magic_string) + + if translated_magic_string != magic_string or locale == "en_US": + current_translation = translation + current_locale = locale + yield locale diff --git a/messages.po b/messages.po index 465954c9..074159c4 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-17 16:19-0400\n" +"POT-Creation-Date: 2018-08-20 20:42-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,6 +17,36 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.5.3\n" +#. command attached to an object +#: lib/commands.py:11 +msgid "Fill stitch starting position" +msgstr "" + +#. command attached to an object +#: lib/commands.py:14 +msgid "Fill stitch ending position" +msgstr "" + +#. command attached to an object +#: lib/commands.py:17 +msgid "Stop (pause machine) after sewing this object" +msgstr "" + +#. command attached to an object +#: lib/commands.py:20 +msgid "Trim thread after sewing this object" +msgstr "" + +#. command attached to an object +#: lib/commands.py:23 +msgid "Ignore this object (do not stitch)" +msgstr "" + +#. command that affects entire layer +#: lib/commands.py:26 +msgid "Ignore layer (do not stitch any objects in this layer)" +msgstr "" + #: lib/elements/auto_fill.py:11 msgid "Auto-Fill" msgstr "" @@ -339,15 +369,15 @@ msgid "" "be dashed to indicate running stitch. Any kind of dash will work." msgstr "" -#: lib/extensions/base.py:108 +#: lib/extensions/base.py:113 msgid "No embroiderable paths selected." msgstr "" -#: lib/extensions/base.py:110 +#: lib/extensions/base.py:115 msgid "No embroiderable paths found in document." msgstr "" -#: lib/extensions/base.py:111 +#: lib/extensions/base.py:116 msgid "Tip: use Path -> Object to Path to convert non-paths." msgstr "" @@ -428,15 +458,29 @@ msgstr "" msgid "Ink/Stitch Add-ons Installer" msgstr "" -#: lib/extensions/layer_commands.py:28 +#: lib/extensions/layer_commands.py:29 msgid "Please choose one or more commands to add." msgstr "" -#: lib/extensions/object_commands.py:93 +#: lib/extensions/layer_commands.py:41 lib/extensions/object_commands.py:80 +msgid "Ink/Stitch Command" +msgstr "" + +#. : the name of the line that connects a command to the object it applies to +#: lib/extensions/object_commands.py:36 +msgid "connector" +msgstr "" + +#. : the name of a command symbol (example: scissors icon for trim command) +#: lib/extensions/object_commands.py:95 +msgid "command marker" +msgstr "" + +#: lib/extensions/object_commands.py:106 msgid "Please select one or more objects to which to attach commands." msgstr "" -#: lib/extensions/object_commands.py:101 +#: lib/extensions/object_commands.py:114 msgid "Please choose one or more commands to attach." msgstr "" @@ -564,6 +608,13 @@ msgstr "" msgid "No embroidery file formats selected." msgstr "" +#. If you translate this string, that will tell Ink/Stitch to +#. generate menu items for this language in Inkscape's "Extensions" +#. menu. +#: lib/inx/utils.py:43 +msgid "Generate INX files" +msgstr "" + #: lib/simulator.py:40 msgid "Speed up" msgstr "" @@ -800,7 +851,7 @@ msgstr "" msgid "Ink/Stitch Print Preview" msgstr "" -#: print/templates/ui.html:4 +#: print/templates/ui.html:4 templates/print.inx:3 msgid "Print" msgstr "" @@ -899,3 +950,257 @@ 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 "" + +#: templates/convert_to_satin.inx:3 +msgid "Convert Line to Satin" +msgstr "" + +#: templates/convert_to_satin.inx:12 templates/embroider.inx:23 +#: 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 +msgid "English" +msgstr "" + +#: templates/embroider.inx:3 +msgid "Embroider" +msgstr "" + +#: templates/embroider.inx:7 +msgid "Collapse length (mm)" +msgstr "" + +#: templates/embroider.inx:7 +msgid "Jump stitches smaller than this will be treated as normal stitches." +msgstr "" + +#: templates/embroider.inx:8 +msgid "Hide other layers" +msgstr "" + +#: templates/embroider.inx:8 +msgid "" +"Hide all other top-level layers when the embroidery layer is generated, " +"in order to make stitching discernible." +msgstr "" + +#: templates/embroider.inx:9 +msgid "Output file format" +msgstr "" + +#: templates/embroider.inx:14 +msgid "DEBUG" +msgstr "" + +#: templates/embroider.inx:17 +msgid "Directory" +msgstr "" + +#: templates/embroider.inx:17 +msgid "Leave empty to save the output in Inkscape's extension directory." +msgstr "" + +#: templates/flip.inx:3 +msgid "Flip Satin Columns" +msgstr "" + +#: templates/input.inx:11 +#, python-format +msgid "convert %(file_extension)s file to Ink/Stitch manual-stitch paths" +msgstr "" + +#: templates/install.inx:3 +msgid "Install add-ons for Inkscape" +msgstr "" + +#: templates/layer_commands.inx:3 +msgid "Add Layer Commands" +msgstr "" + +#: templates/layer_commands.inx:7 +msgid "Commands will be added to the currently-selected layer." +msgstr "" + +#: templates/object_commands.inx:3 +msgid "Attach Commands" +msgstr "" + +#: templates/output.inx:11 +#, python-format +msgid "Save design in %(file_extension)s format using Ink/Stitch" +msgstr "" + +#: templates/params.inx:3 +msgid "Params" +msgstr "" + +#: templates/simulate.inx:3 +msgid "Simulate" +msgstr "" + +#: templates/zip.inx:10 +msgid "Ink/Stitch: ZIP export multiple formats (.zip)" +msgstr "" + +#: templates/zip.inx:11 +msgid "Create a ZIP with multiple embroidery file formats using Ink/Stitch" +msgstr "" + diff --git a/requirements.txt b/requirements.txt index 8fbea7cd..84bb1d51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ numpy jinja2 requests colormath +stringcase # We're not ready for flask 1.0 yet. Logging changed, among othe things. flask==0.* diff --git a/inx/inkstitch_convert_to_satin.inx b/templates/convert_to_satin.inx index d71b2081..50886d4a 100644 --- a/inx/inkstitch_convert_to_satin.inx +++ b/templates/convert_to_satin.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Convert Line to Satin</_name> - <id>org.inkstitch.convert_to_satin</id> + <name>{% trans %}Convert Line to Satin{% endtrans %}</name> + <id>org.inkstitch.convert_to_satin.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">convert_to_satin</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery" /> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/templates/embroider.inx b/templates/embroider.inx new file mode 100644 index 00000000..d89b4d6f --- /dev/null +++ b/templates/embroider.inx @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <name>{% trans %}Embroider{% endtrans %}</name> + <id>org.inkstitch.embroider.{{ locale }}</id> + <dependency type="executable" location="extensions">inkstitch.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + <param name="collapse_len_mm" type="float" min="0.0" max="10.0" _gui-text="{% trans %}Collapse length (mm){% endtrans %}" _gui-description="{% trans %}Jump stitches smaller than this will be treated as normal stitches.{% endtrans %}">3.0</param> + <param name="hide_layers" type="boolean" _gui-text="{% trans %}Hide other layers{% endtrans %}" _gui-description="{% trans %}Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernible.{% endtrans %}">true</param> + <param name="output_format" type="optiongroup" _gui-text="{% trans %}Output file format{% endtrans %}" appearance="minimal"> + {% for format, description in formats %} + <_option value="{{ format }}">{{ _(description) }} ({{ format | upper }})</_option> + {% endfor %} + {% for format, description in debug_formats %} + <_option value="{{ format }}">{{ _(description) }} ({{ format | upper }}) [{{ _("DEBUG") }}]</_option> + {% endfor %} + </param> + <param name="path" type="string" _gui-text="{% trans %}Directory{% endtrans %}" _gui-description="{% trans %}Leave empty to save the output in Inkscape's extension directory.{% endtrans %}"></param> + <param name="extension" type="string" gui-hidden="true">embroider</param> + <effect> + <object-type>all</object-type> + <effects-menu> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> + </effects-menu> + </effect> + <script> + <command reldir="extensions" interpreter="python">inkstitch.py</command> + </script> +</inkscape-extension> diff --git a/inx/inkstitch_flip.inx b/templates/flip.inx index f129b8d9..ebeb4090 100644 --- a/inx/inkstitch_flip.inx +++ b/templates/flip.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Flip Satin Columns</_name> - <id>org.inkstitch.flip_satins</id> + <name>{% trans %}Flip Satin Columns{% endtrans %}</name> + <id>org.inkstitch.flip_satins.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">flip</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery"/> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/templates/embroider_input.inx b/templates/input.inx index 15ccdef8..6e810a70 100644 --- a/templates/embroider_input.inx +++ b/templates/input.inx @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>{{ format | upper }} file input</_name> - <id>org.inkstitch.input.{{ format }}</id> + <name>{{ format | upper }} file input</name> + <id>org.inkstitch.input.{{ format }}.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <input> <extension>.{{ format }}</extension> <mimetype>application/x-embroidery-{{ format }}</mimetype> - <_filetypename>Ink/Stitch: {{ description }} (.{{ format }})</_filetypename> - <_filetypetooltip>convert {{ format | upper }} file to Ink/Stitch manual-stitch paths</_filetypetooltip> + <_filetypename>Ink/Stitch: {{ _(description) }} (.{{ format }})</_filetypename> + <_filetypetooltip>{{ _("convert %(file_extension)s file to Ink/Stitch manual-stitch paths") % dict(file_extension=format.upper()) }}</_filetypetooltip> </input> <param name="extension" type="string" gui-hidden="true">input</param> <script> diff --git a/inx/inkstitch_install.inx b/templates/install.inx index 7275e13a..f3aa6c0a 100644 --- a/inx/inkstitch_install.inx +++ b/templates/install.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Install add-ons for Inkscape</_name> - <id>org.inkstitch.install</id> + <name>{% trans %}Install add-ons for Inkscape{% endtrans %}</name> + <id>org.inkstitch.install.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">install</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery"/> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx new file mode 100644 index 00000000..17eb3d83 --- /dev/null +++ b/templates/layer_commands.inx @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <name>{% trans %}Add Layer Commands{% endtrans %}</name> + <id>org.inkstitch.layer_commands.{{ locale }}</id> + <dependency type="executable" location="extensions">inkstitch.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + <param name="description" type="description">{% trans %}Commands will be added to the currently-selected layer.{% endtrans %}</param> + {% for command, description in layer_commands %} + <param name="{{ command }}" type="boolean" _gui-text="{{ _(description) }}">false</param> + {% endfor %} + <param name="extension" type="string" gui-hidden="true">layer_commands</param> + <effect> + <object-type>all</object-type> + <submenu name="Ink/Stitch"> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> + </submenu> + </effect> + <script> + <command reldir="extensions" interpreter="python">inkstitch.py</command> + </script> +</inkscape-extension> diff --git a/templates/object_commands.inx b/templates/object_commands.inx new file mode 100644 index 00000000..5807dc47 --- /dev/null +++ b/templates/object_commands.inx @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <name>{% trans %}Attach Commands{% endtrans %}</name> + <id>org.inkstitch.commands.{{ locale }}</id> + <dependency type="executable" location="extensions">inkstitch.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + {% for command, description in object_commands %} + <param name="{{ object }}" type="boolean" _gui-text="{{ _(description ) }}">false</param> + {% endfor %} + <effect> + <object-type>all</object-type> + <submenu name="Ink/Stitch"> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> + </submenu> + </effect> + <script> + <command reldir="extensions" interpreter="python">inkstitch.py</command> + </script> +</inkscape-extension> diff --git a/templates/embroider_output.inx b/templates/output.inx index 4f971fb3..2dc36d72 100644 --- a/templates/embroider_output.inx +++ b/templates/output.inx @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>{{ format | upper }} file output</_name> - <id>org.inkstitch.output.{{ format }}</id> + <name>{{ format | upper }} file output</name> + <id>org.inkstitch.output.{{ format }}.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <output> <extension>.{{ format }}</extension> <mimetype>application/x-embroidery-{{ format }}</mimetype> - <_filetypename>Ink/Stitch: {{ description }} (.{{ format }})</_filetypename> - <_filetypetooltip>Save design in {{ format | upper }} format using Ink/Stitch</_filetypetooltip> + <_filetypename>Ink/Stitch: {{ _(description) }} (.{{ format }})</_filetypename> + <_filetypetooltip>{{ _("Save design in %(file_extension)s format using Ink/Stitch") % dict(file_extension=format.upper()) }}</_filetypetooltip> <dataloss>true</dataloss> </output> <param name="extension" type="string" gui-hidden="true">output</param> diff --git a/inx/inkstitch_params.inx b/templates/params.inx index 7b3b4e63..f785b15c 100644 --- a/inx/inkstitch_params.inx +++ b/templates/params.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Params</_name> - <id>jonh.embroider.params</id> + <name>{% trans %}Params{% endtrans %}</name> + <id>org.inkstitch.params.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">params</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery"/> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/inx/inkstitch_print.inx b/templates/print.inx index edc96a4c..9e5a9dcd 100644 --- a/inx/inkstitch_print.inx +++ b/templates/print.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Print</_name> - <id>jonh.embroider.print</id> + <name>{% trans %}Print{% endtrans %}</name> + <id>org.inkstitch.print.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">print</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery"/> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/inx/inkstitch_simulate.inx b/templates/simulate.inx index 66f892d8..33919cbb 100644 --- a/inx/inkstitch_simulate.inx +++ b/templates/simulate.inx @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>Simulate</_name> - <id>jonh.embroider.simulate</id> + <name>{% trans %}Simulate{% endtrans %}</name> + <id>org.inkstitch.simulate.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <param name="extension" type="string" gui-hidden="true">simulate</param> <effect> <object-type>all</object-type> <effects-menu> - <submenu _name="Embroidery"/> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}" /> + </submenu> </effects-menu> </effect> <script> diff --git a/templates/embroider_zip_output.inx b/templates/zip.inx index 5d162357..7b576349 100644 --- a/templates/embroider_zip_output.inx +++ b/templates/zip.inx @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <_name>embroidery ZIP file output</_name> - <id>org.inkstitch.output.zip</id> + <name>embroidery ZIP file output</name> + <id>org.inkstitch.output.zip.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> <output> <extension>.zip</extension> <mimetype>application/zip</mimetype> - <_filetypename>Ink/Stitch: ZIP export multiple formats (.zip)</_filetypename> - <_filetypetooltip>Create a ZIP with multiple embroidery file formats using Ink/Stitch</_filetypetooltip> + <_filetypename>{{ _("Ink/Stitch: ZIP export multiple formats (.zip)") }}"</_filetypename> + <_filetypetooltip>{{ _("Create a ZIP with multiple embroidery file formats using Ink/Stitch") }}</_filetypetooltip> <dataloss>true</dataloss> </output> -{% for format, description in formats %} - <param name="format-{{format}}" type="boolean" _gui-text=".{{format | upper}}: {{description}}">false</param> -{% endfor %} + {% for format, description in formats %} + <param name="format-{{ format }}" type="boolean" _gui-text=".{{ format | upper }}: {{ _(description) }}">false</param> + {% endfor %} <param name="extension" type="string" gui-hidden="true">zip</param> <script> <command reldir="extensions" interpreter="python">inkstitch.py</command> diff --git a/translations/messages_cs_CZ.po b/translations/messages_cs_CZ.po index c2c1f4e5..7da8524f 100644 --- a/translations/messages_cs_CZ.po +++ b/translations/messages_cs_CZ.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: inkstitch\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2018-08-11 22:57-0400\n" -"PO-Revision-Date: 2018-08-12 03:11\n" +"PO-Revision-Date: 2018-08-21 20:20\n" "Last-Translator: lexelby <github.com@lexneva.name>\n" "Language-Team: Czech\n" "MIME-Version: 1.0\n" @@ -17,6 +17,36 @@ msgstr "" "X-Crowdin-File: /master/messages.po\n" "Language: cs_CZ\n" +#. command attached to an object +#: lib/commands.py:11 +msgid "Fill stitch starting position" +msgstr "" + +#. command attached to an object +#: lib/commands.py:14 +msgid "Fill stitch ending position" +msgstr "" + +#. command attached to an object +#: lib/commands.py:17 +msgid "Stop (pause machine) after sewing this object" +msgstr "" + +#. command attached to an object +#: lib/commands.py:20 +msgid "Trim thread after sewing this object" +msgstr "" + +#. command attached to an object +#: lib/commands.py:23 +msgid "Ignore this object (do not stitch)" +msgstr "" + +#. command that affects entire layer +#: lib/commands.py:26 +msgid "Ignore layer (do not stitch any objects in this layer)" +msgstr "" + #: lib/elements/auto_fill.py:11 msgid "Auto-Fill" msgstr "" @@ -501,11 +531,18 @@ msgstr "" msgid "No embroidery file formats selected." msgstr "" -#: lib/simulator.py:34 +#. If you translate this string, that will tell Ink/Stitch to +#. generate menu items for this language in Inkscape's "Extensions" +#. menu. +#: lib/inx/utils.py:43 +msgid "Generate INX files" +msgstr "INX translation test" + +#: lib/simulator.py:40 msgid "Speed up" msgstr "" -#: lib/simulator.py:34 +#: lib/simulator.py:40 msgid "Press + or arrow up to speed up" msgstr "" @@ -821,3 +858,255 @@ 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 "Brother Embroidery Format (translation test)" + +#. description for pyembroidery file format: exp +#: pyembroidery-format-descriptions.py:6 +msgid "Melco Embroidery Format" +msgstr "Melco Embroidery Format (translation test)" + +#. 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 "Tajima Embroidery Format (translation test)" + +#. 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 "Janome Embroidery Format (translation test)" + +#. 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 "Tajima(Barudan) Embroidery Format (translation test)" + +#. 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 "" + +#: templates/convert_to_satin.inx:3 +msgid "Convert Line to Satin" +msgstr "" + +#: templates/convert_to_satin.inx:12 templates/embroider.inx:23 +#: 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 +msgid "English" +msgstr "Translation test (czech)" + +#: templates/embroider.inx:3 +msgid "Embroider" +msgstr "" + +#: templates/embroider.inx:7 +msgid "Collapse length (mm)" +msgstr "" + +#: templates/embroider.inx:7 +msgid "Jump stitches smaller than this will be treated as normal stitches." +msgstr "" + +#: templates/embroider.inx:8 +msgid "Hide other layers" +msgstr "Hide other layers (translation test)" + +#: templates/embroider.inx:8 +msgid "Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernible." +msgstr "Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernible. (translation test)" + +#: templates/embroider.inx:9 +msgid "Output file format" +msgstr "" + +#: templates/embroider.inx:14 +msgid "DEBUG" +msgstr "" + +#: templates/embroider.inx:17 +msgid "Directory" +msgstr "Directory (translation test)" + +#: templates/embroider.inx:17 +msgid "Leave empty to save the output in Inkscape's extension directory." +msgstr "" + +#: templates/flip.inx:3 +msgid "Flip Satin Columns" +msgstr "" + +#: templates/input.inx:11 +#, python-format +msgid "convert %(file_extension)s file to Ink/Stitch manual-stitch paths" +msgstr "" + +#: templates/install.inx:3 +msgid "Install add-ons for Inkscape" +msgstr "" + +#: templates/layer_commands.inx:3 +msgid "Add Layer Commands" +msgstr "" + +#: templates/layer_commands.inx:7 +msgid "Commands will be added to the currently-selected layer." +msgstr "" + +#: templates/object_commands.inx:3 +msgid "Attach Commands" +msgstr "" + +#: templates/output.inx:11 +#, python-format +msgid "Save design in %(file_extension)s format using Ink/Stitch" +msgstr "" + +#: templates/params.inx:3 +msgid "Params" +msgstr "" + +#: templates/simulate.inx:3 +msgid "Simulate" +msgstr "" + +#: templates/zip.inx:10 +msgid "Ink/Stitch: ZIP export multiple formats (.zip)" +msgstr "" + +#: templates/zip.inx:11 +msgid "Create a ZIP with multiple embroidery file formats using Ink/Stitch" +msgstr "" + |
