From b4dd5a1e8fac21b4d40e3a839715834ea243e49a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 12 Jun 2018 21:48:38 -0400 Subject: add zip INX generator and INX --- bin/gen-zip-inx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 bin/gen-zip-inx (limited to 'bin/gen-zip-inx') 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()) -- cgit v1.2.3 From d189f88050df2db19226f50c80b0304c7bd1bd28 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 20:19:17 -0400 Subject: update zip output generator and INX --- bin/gen-zip-inx | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'bin/gen-zip-inx') diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx index 5fbc8f1e..40948786 100755 --- a/bin/gen-zip-inx +++ b/bin/gen-zip-inx @@ -2,7 +2,7 @@ import sys, os from os.path import dirname -from libembroidery import * +import pyembroidery from jinja2 import Environment, FileSystemLoader, select_autoescape @@ -15,26 +15,17 @@ def build_environment(): ) -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 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=libembroidery_output_formats()) + inx = template.render(formats=pyembroidery_output_formats()) with open("inx/inkstitch_output_ZIP.inx", 'w') as inx_file: inx_file.write(inx) -- cgit v1.2.3