From 40a343128043b7d2ebe3a770dfae887e969fc5e0 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 12 Jun 2018 20:54:51 -0400 Subject: [PATCH] add output INX generator --- bin/gen-input-inx | 4 +-- bin/gen-output-inx | 45 ++++++++++++++++++++++++++++++++++ inx/inkstitch_output_COL.inx | 19 ++++++++++++++ inx/inkstitch_output_CSV.inx | 19 ++++++++++++++ inx/inkstitch_output_DST.inx | 19 ++++++++++++++ inx/inkstitch_output_EDR.inx | 19 ++++++++++++++ inx/inkstitch_output_EXP.inx | 19 ++++++++++++++ inx/inkstitch_output_HUS.inx | 19 ++++++++++++++ inx/inkstitch_output_INF.inx | 19 ++++++++++++++ inx/inkstitch_output_JEF.inx | 19 ++++++++++++++ inx/inkstitch_output_KSM.inx | 19 ++++++++++++++ inx/inkstitch_output_MAX.inx | 19 ++++++++++++++ inx/inkstitch_output_PCD.inx | 19 ++++++++++++++ inx/inkstitch_output_PCQ.inx | 19 ++++++++++++++ inx/inkstitch_output_PCS.inx | 19 ++++++++++++++ inx/inkstitch_output_PEC.inx | 19 ++++++++++++++ inx/inkstitch_output_PES.inx | 19 ++++++++++++++ inx/inkstitch_output_PLT.inx | 19 ++++++++++++++ inx/inkstitch_output_RGB.inx | 19 ++++++++++++++ inx/inkstitch_output_THR.inx | 19 ++++++++++++++ inx/inkstitch_output_TXT.inx | 19 ++++++++++++++ inx/inkstitch_output_VP3.inx | 19 ++++++++++++++ inx/inkstitch_output_XXX.inx | 19 ++++++++++++++ templates/embroider_input.inx | 1 - templates/embroider_output.inx | 19 ++++++++++++++ 25 files changed, 465 insertions(+), 3 deletions(-) create mode 100755 bin/gen-output-inx create mode 100644 inx/inkstitch_output_COL.inx create mode 100644 inx/inkstitch_output_CSV.inx create mode 100644 inx/inkstitch_output_DST.inx create mode 100644 inx/inkstitch_output_EDR.inx create mode 100644 inx/inkstitch_output_EXP.inx create mode 100644 inx/inkstitch_output_HUS.inx create mode 100644 inx/inkstitch_output_INF.inx create mode 100644 inx/inkstitch_output_JEF.inx create mode 100644 inx/inkstitch_output_KSM.inx create mode 100644 inx/inkstitch_output_MAX.inx create mode 100644 inx/inkstitch_output_PCD.inx create mode 100644 inx/inkstitch_output_PCQ.inx create mode 100644 inx/inkstitch_output_PCS.inx create mode 100644 inx/inkstitch_output_PEC.inx create mode 100644 inx/inkstitch_output_PES.inx create mode 100644 inx/inkstitch_output_PLT.inx create mode 100644 inx/inkstitch_output_RGB.inx create mode 100644 inx/inkstitch_output_THR.inx create mode 100644 inx/inkstitch_output_TXT.inx create mode 100644 inx/inkstitch_output_VP3.inx create mode 100644 inx/inkstitch_output_XXX.inx create mode 100644 templates/embroider_output.inx diff --git a/bin/gen-input-inx b/bin/gen-input-inx index 5f21ce84a..6351d062e 100755 --- a/bin/gen-input-inx +++ b/bin/gen-input-inx @@ -21,9 +21,9 @@ def libembroidery_input_formats(): while(curFormat): extension = embFormat_extension(curFormat) description = embFormat_description(curFormat) - writerState = embFormat_readerState(curFormat) + reader_state = embFormat_readerState(curFormat) - if writerState.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY: + if reader_state.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY: # extension includes the dot, so we'll remove it yield extension[1:], description diff --git a/bin/gen-output-inx b/bin/gen-output-inx new file mode 100755 index 000000000..f167dbeea --- /dev/null +++ b/bin/gen-output-inx @@ -0,0 +1,45 @@ +#!/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_output.inx') + + for format, description in libembroidery_output_formats(): + inx = template.render(format=format, description=description) + + with open("inx/inkstitch_output_%s.inx" % format.upper(), 'w') as inx_file: + inx_file.write(inx) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/inx/inkstitch_output_COL.inx b/inx/inkstitch_output_COL.inx new file mode 100644 index 000000000..8a240a38d --- /dev/null +++ b/inx/inkstitch_output_COL.inx @@ -0,0 +1,19 @@ + + + <_name>COL file output + org.inkstitch.output.col + inkstitch.py + inkex.py + + .col + application/x-embroidery-col + <_filetypename>Ink/Stitch: Embroidery Thread Color Format (.col) + <_filetypetooltip>Save design in COL format using Ink/Stitch + true + + output + col + + \ No newline at end of file diff --git a/inx/inkstitch_output_CSV.inx b/inx/inkstitch_output_CSV.inx new file mode 100644 index 000000000..d2f340cdc --- /dev/null +++ b/inx/inkstitch_output_CSV.inx @@ -0,0 +1,19 @@ + + + <_name>CSV file output + org.inkstitch.output.csv + inkstitch.py + inkex.py + + .csv + application/x-embroidery-csv + <_filetypename>Ink/Stitch: Comma Separated Values Format (.csv) + <_filetypetooltip>Save design in CSV format using Ink/Stitch + true + + output + csv + + \ No newline at end of file diff --git a/inx/inkstitch_output_DST.inx b/inx/inkstitch_output_DST.inx new file mode 100644 index 000000000..2230600a7 --- /dev/null +++ b/inx/inkstitch_output_DST.inx @@ -0,0 +1,19 @@ + + + <_name>DST file output + org.inkstitch.output.dst + inkstitch.py + inkex.py + + .dst + application/x-embroidery-dst + <_filetypename>Ink/Stitch: Tajima Embroidery Format (.dst) + <_filetypetooltip>Save design in DST format using Ink/Stitch + true + + output + dst + + \ No newline at end of file diff --git a/inx/inkstitch_output_EDR.inx b/inx/inkstitch_output_EDR.inx new file mode 100644 index 000000000..0756b37af --- /dev/null +++ b/inx/inkstitch_output_EDR.inx @@ -0,0 +1,19 @@ + + + <_name>EDR file output + org.inkstitch.output.edr + inkstitch.py + inkex.py + + .edr + application/x-embroidery-edr + <_filetypename>Ink/Stitch: Embird Embroidery Format (.edr) + <_filetypetooltip>Save design in EDR format using Ink/Stitch + true + + output + edr + + \ No newline at end of file diff --git a/inx/inkstitch_output_EXP.inx b/inx/inkstitch_output_EXP.inx new file mode 100644 index 000000000..ce98dbc02 --- /dev/null +++ b/inx/inkstitch_output_EXP.inx @@ -0,0 +1,19 @@ + + + <_name>EXP file output + org.inkstitch.output.exp + inkstitch.py + inkex.py + + .exp + application/x-embroidery-exp + <_filetypename>Ink/Stitch: Melco Embroidery Format (.exp) + <_filetypetooltip>Save design in EXP format using Ink/Stitch + true + + output + exp + + \ No newline at end of file diff --git a/inx/inkstitch_output_HUS.inx b/inx/inkstitch_output_HUS.inx new file mode 100644 index 000000000..44536f2a4 --- /dev/null +++ b/inx/inkstitch_output_HUS.inx @@ -0,0 +1,19 @@ + + + <_name>HUS file output + org.inkstitch.output.hus + inkstitch.py + inkex.py + + .hus + application/x-embroidery-hus + <_filetypename>Ink/Stitch: Husqvarna Viking Embroidery Format (.hus) + <_filetypetooltip>Save design in HUS format using Ink/Stitch + true + + output + hus + + \ No newline at end of file diff --git a/inx/inkstitch_output_INF.inx b/inx/inkstitch_output_INF.inx new file mode 100644 index 000000000..47c2b63ef --- /dev/null +++ b/inx/inkstitch_output_INF.inx @@ -0,0 +1,19 @@ + + + <_name>INF file output + org.inkstitch.output.inf + inkstitch.py + inkex.py + + .inf + application/x-embroidery-inf + <_filetypename>Ink/Stitch: Embroidery Color Format (.inf) + <_filetypetooltip>Save design in INF format using Ink/Stitch + true + + output + inf + + \ No newline at end of file diff --git a/inx/inkstitch_output_JEF.inx b/inx/inkstitch_output_JEF.inx new file mode 100644 index 000000000..af92a8369 --- /dev/null +++ b/inx/inkstitch_output_JEF.inx @@ -0,0 +1,19 @@ + + + <_name>JEF file output + org.inkstitch.output.jef + inkstitch.py + inkex.py + + .jef + application/x-embroidery-jef + <_filetypename>Ink/Stitch: Janome Embroidery Format (.jef) + <_filetypetooltip>Save design in JEF format using Ink/Stitch + true + + output + jef + + \ No newline at end of file diff --git a/inx/inkstitch_output_KSM.inx b/inx/inkstitch_output_KSM.inx new file mode 100644 index 000000000..ad5ae4dd1 --- /dev/null +++ b/inx/inkstitch_output_KSM.inx @@ -0,0 +1,19 @@ + + + <_name>KSM file output + org.inkstitch.output.ksm + inkstitch.py + inkex.py + + .ksm + application/x-embroidery-ksm + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.ksm) + <_filetypetooltip>Save design in KSM format using Ink/Stitch + true + + output + ksm + + \ No newline at end of file diff --git a/inx/inkstitch_output_MAX.inx b/inx/inkstitch_output_MAX.inx new file mode 100644 index 000000000..45a5ba011 --- /dev/null +++ b/inx/inkstitch_output_MAX.inx @@ -0,0 +1,19 @@ + + + <_name>MAX file output + org.inkstitch.output.max + inkstitch.py + inkex.py + + .max + application/x-embroidery-max + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.max) + <_filetypetooltip>Save design in MAX format using Ink/Stitch + true + + output + max + + \ No newline at end of file diff --git a/inx/inkstitch_output_PCD.inx b/inx/inkstitch_output_PCD.inx new file mode 100644 index 000000000..b42f79de9 --- /dev/null +++ b/inx/inkstitch_output_PCD.inx @@ -0,0 +1,19 @@ + + + <_name>PCD file output + org.inkstitch.output.pcd + inkstitch.py + inkex.py + + .pcd + application/x-embroidery-pcd + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.pcd) + <_filetypetooltip>Save design in PCD format using Ink/Stitch + true + + output + pcd + + \ No newline at end of file diff --git a/inx/inkstitch_output_PCQ.inx b/inx/inkstitch_output_PCQ.inx new file mode 100644 index 000000000..1764f6708 --- /dev/null +++ b/inx/inkstitch_output_PCQ.inx @@ -0,0 +1,19 @@ + + + <_name>PCQ file output + org.inkstitch.output.pcq + inkstitch.py + inkex.py + + .pcq + application/x-embroidery-pcq + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.pcq) + <_filetypetooltip>Save design in PCQ format using Ink/Stitch + true + + output + pcq + + \ No newline at end of file diff --git a/inx/inkstitch_output_PCS.inx b/inx/inkstitch_output_PCS.inx new file mode 100644 index 000000000..ef07c4bde --- /dev/null +++ b/inx/inkstitch_output_PCS.inx @@ -0,0 +1,19 @@ + + + <_name>PCS file output + org.inkstitch.output.pcs + inkstitch.py + inkex.py + + .pcs + application/x-embroidery-pcs + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.pcs) + <_filetypetooltip>Save design in PCS format using Ink/Stitch + true + + output + pcs + + \ No newline at end of file diff --git a/inx/inkstitch_output_PEC.inx b/inx/inkstitch_output_PEC.inx new file mode 100644 index 000000000..15880ce6b --- /dev/null +++ b/inx/inkstitch_output_PEC.inx @@ -0,0 +1,19 @@ + + + <_name>PEC file output + org.inkstitch.output.pec + inkstitch.py + inkex.py + + .pec + application/x-embroidery-pec + <_filetypename>Ink/Stitch: Brother Embroidery Format (.pec) + <_filetypetooltip>Save design in PEC format using Ink/Stitch + true + + output + pec + + \ No newline at end of file diff --git a/inx/inkstitch_output_PES.inx b/inx/inkstitch_output_PES.inx new file mode 100644 index 000000000..cd7e73697 --- /dev/null +++ b/inx/inkstitch_output_PES.inx @@ -0,0 +1,19 @@ + + + <_name>PES file output + org.inkstitch.output.pes + inkstitch.py + inkex.py + + .pes + application/x-embroidery-pes + <_filetypename>Ink/Stitch: Brother Embroidery Format (.pes) + <_filetypetooltip>Save design in PES format using Ink/Stitch + true + + output + pes + + \ No newline at end of file diff --git a/inx/inkstitch_output_PLT.inx b/inx/inkstitch_output_PLT.inx new file mode 100644 index 000000000..649ef76b4 --- /dev/null +++ b/inx/inkstitch_output_PLT.inx @@ -0,0 +1,19 @@ + + + <_name>PLT file output + org.inkstitch.output.plt + inkstitch.py + inkex.py + + .plt + application/x-embroidery-plt + <_filetypename>Ink/Stitch: AutoCAD Plot Drawing Format (.plt) + <_filetypetooltip>Save design in PLT format using Ink/Stitch + true + + output + plt + + \ No newline at end of file diff --git a/inx/inkstitch_output_RGB.inx b/inx/inkstitch_output_RGB.inx new file mode 100644 index 000000000..e60d729ea --- /dev/null +++ b/inx/inkstitch_output_RGB.inx @@ -0,0 +1,19 @@ + + + <_name>RGB file output + org.inkstitch.output.rgb + inkstitch.py + inkex.py + + .rgb + application/x-embroidery-rgb + <_filetypename>Ink/Stitch: RGB Embroidery Format (.rgb) + <_filetypetooltip>Save design in RGB format using Ink/Stitch + true + + output + rgb + + \ No newline at end of file diff --git a/inx/inkstitch_output_THR.inx b/inx/inkstitch_output_THR.inx new file mode 100644 index 000000000..c460bdfc5 --- /dev/null +++ b/inx/inkstitch_output_THR.inx @@ -0,0 +1,19 @@ + + + <_name>THR file output + org.inkstitch.output.thr + inkstitch.py + inkex.py + + .thr + application/x-embroidery-thr + <_filetypename>Ink/Stitch: ThredWorks Embroidery Format (.thr) + <_filetypetooltip>Save design in THR format using Ink/Stitch + true + + output + thr + + \ No newline at end of file diff --git a/inx/inkstitch_output_TXT.inx b/inx/inkstitch_output_TXT.inx new file mode 100644 index 000000000..805deffe8 --- /dev/null +++ b/inx/inkstitch_output_TXT.inx @@ -0,0 +1,19 @@ + + + <_name>TXT file output + org.inkstitch.output.txt + inkstitch.py + inkex.py + + .txt + application/x-embroidery-txt + <_filetypename>Ink/Stitch: Text File (.txt) + <_filetypetooltip>Save design in TXT format using Ink/Stitch + true + + output + txt + + \ No newline at end of file diff --git a/inx/inkstitch_output_VP3.inx b/inx/inkstitch_output_VP3.inx new file mode 100644 index 000000000..dff29de44 --- /dev/null +++ b/inx/inkstitch_output_VP3.inx @@ -0,0 +1,19 @@ + + + <_name>VP3 file output + org.inkstitch.output.vp3 + inkstitch.py + inkex.py + + .vp3 + application/x-embroidery-vp3 + <_filetypename>Ink/Stitch: Pfaff Embroidery Format (.vp3) + <_filetypetooltip>Save design in VP3 format using Ink/Stitch + true + + output + vp3 + + \ No newline at end of file diff --git a/inx/inkstitch_output_XXX.inx b/inx/inkstitch_output_XXX.inx new file mode 100644 index 000000000..ad4135b03 --- /dev/null +++ b/inx/inkstitch_output_XXX.inx @@ -0,0 +1,19 @@ + + + <_name>XXX file output + org.inkstitch.output.xxx + inkstitch.py + inkex.py + + .xxx + application/x-embroidery-xxx + <_filetypename>Ink/Stitch: Singer Embroidery Format (.xxx) + <_filetypetooltip>Save design in XXX format using Ink/Stitch + true + + output + xxx + + \ No newline at end of file diff --git a/templates/embroider_input.inx b/templates/embroider_input.inx index 24bba7e44..15ccdef8e 100644 --- a/templates/embroider_input.inx +++ b/templates/embroider_input.inx @@ -15,4 +15,3 @@ inkstitch.py - diff --git a/templates/embroider_output.inx b/templates/embroider_output.inx new file mode 100644 index 000000000..4f971fb3b --- /dev/null +++ b/templates/embroider_output.inx @@ -0,0 +1,19 @@ + + + <_name>{{ format | upper }} file output + org.inkstitch.output.{{ format }} + inkstitch.py + inkex.py + + .{{ format }} + application/x-embroidery-{{ format }} + <_filetypename>Ink/Stitch: {{ description }} (.{{ format }}) + <_filetypetooltip>Save design in {{ format | upper }} format using Ink/Stitch + true + + output + {{ format }} + +