diff options
| -rwxr-xr-x | bin/gen-zip-inx | 44 | ||||
| -rw-r--r-- | inx/inkstitch_output_ZIP.inx | 61 | ||||
| -rw-r--r-- | messages.po | 2 | ||||
| -rw-r--r-- | templates/embroider_zip_output.inx | 21 |
4 files changed, 127 insertions, 1 deletions
diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx new file mode 100755 index 00000000..5fbc8f1e --- /dev/null +++ b/bin/gen-zip-inx @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +import sys, os +from os.path import dirname +from libembroidery import * +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 libembroidery_output_formats(): + formatList = embFormatList_create() + curFormat = formatList + while(curFormat): + extension = embFormat_extension(curFormat) + description = embFormat_description(curFormat) + writer_state = embFormat_writerState(curFormat) + + if writer_state.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY: + # extension includes the dot, so we'll remove it + yield extension[1:], description + + curFormat = curFormat.next + + +def main(): + env = build_environment() + template = env.get_template('embroider_zip_output.inx') + + inx = template.render(formats=libembroidery_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/inx/inkstitch_output_ZIP.inx b/inx/inkstitch_output_ZIP.inx new file mode 100644 index 00000000..b5b2cf1c --- /dev/null +++ b/inx/inkstitch_output_ZIP.inx @@ -0,0 +1,61 @@ +<?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-col" type="boolean" _gui-text=".COL: Embroidery Thread Color Format">false</param> + + <param name="format-csv" type="boolean" _gui-text=".CSV: Comma Separated Values Format">false</param> + + <param name="format-dst" type="boolean" _gui-text=".DST: Tajima Embroidery Format">false</param> + + <param name="format-edr" type="boolean" _gui-text=".EDR: Embird Embroidery Format">false</param> + + <param name="format-exp" type="boolean" _gui-text=".EXP: Melco Embroidery Format">false</param> + + <param name="format-hus" type="boolean" _gui-text=".HUS: Husqvarna Viking Embroidery Format">false</param> + + <param name="format-inf" type="boolean" _gui-text=".INF: Embroidery Color Format">false</param> + + <param name="format-jef" type="boolean" _gui-text=".JEF: Janome Embroidery Format">false</param> + + <param name="format-ksm" type="boolean" _gui-text=".KSM: Pfaff Embroidery Format">false</param> + + <param name="format-max" type="boolean" _gui-text=".MAX: Pfaff Embroidery Format">false</param> + + <param name="format-pcd" type="boolean" _gui-text=".PCD: Pfaff Embroidery Format">false</param> + + <param name="format-pcq" type="boolean" _gui-text=".PCQ: Pfaff Embroidery Format">false</param> + + <param name="format-pcs" type="boolean" _gui-text=".PCS: Pfaff Embroidery Format">false</param> + + <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-plt" type="boolean" _gui-text=".PLT: AutoCAD Plot Drawing Format">false</param> + + <param name="format-rgb" type="boolean" _gui-text=".RGB: RGB Embroidery Format">false</param> + + <param name="format-thr" type="boolean" _gui-text=".THR: ThredWorks Embroidery Format">false</param> + + <param name="format-txt" type="boolean" _gui-text=".TXT: Text File">false</param> + + <param name="format-vp3" type="boolean" _gui-text=".VP3: Pfaff Embroidery Format">false</param> + + <param name="format-xxx" type="boolean" _gui-text=".XXX: Singer 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> diff --git a/messages.po b/messages.po index b872f864..36af2e50 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-06-12 20:18-0400\n" +"POT-Creation-Date: 2018-06-15 21:44-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" diff --git a/templates/embroider_zip_output.inx b/templates/embroider_zip_output.inx new file mode 100644 index 00000000..5d162357 --- /dev/null +++ b/templates/embroider_zip_output.inx @@ -0,0 +1,21 @@ +<?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> +{% 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> + </script> +</inkscape-extension> |
