From b4dd5a1e8fac21b4d40e3a839715834ea243e49a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 12 Jun 2018 21:48:38 -0400 Subject: [PATCH] add zip INX generator and INX --- bin/gen-zip-inx | 44 +++++++++++++++++++++ inx/inkstitch_output_ZIP.inx | 61 ++++++++++++++++++++++++++++++ messages.po | 2 +- templates/embroider_zip_output.inx | 21 ++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100755 bin/gen-zip-inx create mode 100644 inx/inkstitch_output_ZIP.inx create mode 100644 templates/embroider_zip_output.inx diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx new file mode 100755 index 000000000..5fbc8f1ee --- /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 000000000..b5b2cf1c7 --- /dev/null +++ b/inx/inkstitch_output_ZIP.inx @@ -0,0 +1,61 @@ + + + <_name>embroidery ZIP file output + org.inkstitch.output.zip + inkstitch.py + inkex.py + + .zip + application/zip + <_filetypename>Ink/Stitch: ZIP export multiple formats (.zip) + <_filetypetooltip>Create a ZIP with multiple embroidery file formats using Ink/Stitch + true + + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + false + + zip + + diff --git a/messages.po b/messages.po index b872f8647..36af2e50a 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 \n" "Language-Team: LANGUAGE \n" diff --git a/templates/embroider_zip_output.inx b/templates/embroider_zip_output.inx new file mode 100644 index 000000000..5d162357c --- /dev/null +++ b/templates/embroider_zip_output.inx @@ -0,0 +1,21 @@ + + + <_name>embroidery ZIP file output + org.inkstitch.output.zip + inkstitch.py + inkex.py + + .zip + application/zip + <_filetypename>Ink/Stitch: ZIP export multiple formats (.zip) + <_filetypetooltip>Create a ZIP with multiple embroidery file formats using Ink/Stitch + true + +{% for format, description in formats %} + false +{% endfor %} + zip + +