From 40a343128043b7d2ebe3a770dfae887e969fc5e0 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 12 Jun 2018 20:54:51 -0400 Subject: add output INX generator --- bin/gen-input-inx | 4 ++-- bin/gen-output-inx | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 bin/gen-output-inx (limited to 'bin') diff --git a/bin/gen-input-inx b/bin/gen-input-inx index 5f21ce84..6351d062 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 00000000..f167dbee --- /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()) -- cgit v1.2.3 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') 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 1bf3689762cbe16952c3a2342dc3e2271458c64b Mon Sep 17 00:00:00 2001 From: AkiraNorthstar Date: Mon, 9 Jul 2018 11:36:43 +0200 Subject: Update build-dist fix build-dist in this branch to make it easier to merge. --- bin/build-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/build-dist b/bin/build-dist index 4d73313a..78e42430 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -29,7 +29,7 @@ else fi # This lets pyinstaller see inkex.py, etc. -pyinstaller_args+="-p inkscape-0.92.2/share/extensions " +pyinstaller_args+="-p inkscape-0.92.3/share/extensions " # output useful debugging info that helps us trace library dependency issues pyinstaller_args+="--log-level DEBUG " -- cgit v1.2.3 From a93e774cd98e9a8ae44e55f09282d0fdc3b77420 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 13 Jul 2018 20:03:26 -0400 Subject: remove libembroidery from build --- bin/build-dist | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/build-dist b/bin/build-dist index 78e42430..0d435580 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -19,14 +19,8 @@ fi # above! pyinstaller_args+="--hidden-import gi.repository.Gtk " -# mac and windows build seem to miss wx and libembroidery import -pyinstaller_args+="--hidden-import wx --hidden-import libembroidery " - -if [ -d windows-libembroidery ]; then - pyinstaller_args+="-p windows-libembroidery " -else - pyinstaller_args+="-p embroidermodder/experimental/python/binding " -fi +# mac and windows build seem to miss wx import +pyinstaller_args+="--hidden-import wx" # This lets pyinstaller see inkex.py, etc. pyinstaller_args+="-p inkscape-0.92.3/share/extensions " -- cgit v1.2.3 From f85ee33af6fdb11bdd85af4e0832b9f2ef40b315 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 16 Jul 2018 19:49:32 -0400 Subject: update Embroider extension for pyembroidery --- bin/gen-output-format-option-list | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'bin') diff --git a/bin/gen-output-format-option-list b/bin/gen-output-format-option-list index 674813bb..28a83976 100755 --- a/bin/gen-output-format-option-list +++ b/bin/gen-output-format-option-list @@ -1,19 +1,14 @@ #!/usr/bin/env python import sys +import pyembroidery -sys.path.append('embroidermodder/experimental/python/binding') -from libembroidery import * +formats = [format for format in pyembroidery.supported_formats() if 'writer' in format] +formats.sort(key=lambda format: (format['category'] != 'embroidery', format['extension'])) -formatList = embFormatList_create() -curFormat = formatList -while(curFormat): - extension = embFormat_extension(curFormat) - description = embFormat_description(curFormat) - writerState = embFormat_writerState(curFormat) - - if writerState.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY: - print '<_option value="%s">%s(%s)' % (extension[1:], description, extension.upper()) - - curFormat = curFormat.next +for format in formats: + tag = "" + if format['category'] != 'embroidery': + tag = " [DEBUG]" + print '<_option value="%s">%s(%s)%s' % (format['extension'], format['description'], format['extension'].upper(), tag) -- cgit v1.2.3 From 17a9f23bfb8b3a150092bc499cdaf533e3390719 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 20:14:23 -0400 Subject: update input extension generator and INXes --- bin/gen-input-inx | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'bin') diff --git a/bin/gen-input-inx b/bin/gen-input-inx index 6351d062..ae32b43f 100755 --- a/bin/gen-input-inx +++ b/bin/gen-input-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,30 +15,21 @@ def build_environment(): ) -def libembroidery_input_formats(): - formatList = embFormatList_create() - curFormat = formatList - while(curFormat): - extension = embFormat_extension(curFormat) - description = embFormat_description(curFormat) - reader_state = embFormat_readerState(curFormat) - - if reader_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_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 libembroidery_input_formats(): + 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: - inx_file.write(inx) + print >> inx_file, inx if __name__ == "__main__": -- cgit v1.2.3 From c061b3a66aaf1f404440e3aa511b8655dd5b1592 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 20:17:48 -0400 Subject: update output extension generator and INXes --- bin/gen-output-inx | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'bin') diff --git a/bin/gen-output-inx b/bin/gen-output-inx index f167dbee..fbe2ad55 100755 --- a/bin/gen-output-inx +++ b/bin/gen-output-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,30 +15,21 @@ 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_output.inx') - for format, description in libembroidery_output_formats(): + 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: - inx_file.write(inx) + print >> inx_file, inx if __name__ == "__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') 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 From 4dc228e15e56d5a692b2901e08d9c9c6de1e6824 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 21:46:14 -0400 Subject: add pyembroidery-convert --- bin/pyembroidery-convert | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/pyembroidery-convert (limited to 'bin') diff --git a/bin/pyembroidery-convert b/bin/pyembroidery-convert new file mode 100755 index 00000000..ac58e3e5 --- /dev/null +++ b/bin/pyembroidery-convert @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import sys +import pyembroidery + +pyembroidery.convert(sys.argv[1], sys.argv[2]) -- cgit v1.2.3 From c0745f2b580c59b80c7b5a690bd9c0d8f5082968 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 21:46:26 -0400 Subject: remove libembroidery-convert install script --- bin/install_libembroidery-convert_Ubuntu.sh | 58 ----------------------------- 1 file changed, 58 deletions(-) delete mode 100644 bin/install_libembroidery-convert_Ubuntu.sh (limited to 'bin') diff --git a/bin/install_libembroidery-convert_Ubuntu.sh b/bin/install_libembroidery-convert_Ubuntu.sh deleted file mode 100644 index ef2626bd..00000000 --- a/bin/install_libembroidery-convert_Ubuntu.sh +++ /dev/null @@ -1,58 +0,0 @@ -# This file is part of the Inkscape extension 'ink/stitch', -# an extension for machine embroidery design using Inkscape. - -# Copyright (C) 2017 Maren Hachmann - -# ink/stitch is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# ink/stitch is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with ink/stitch. If not, see . - -#!/bin/bash - -# make sure we're in tmp directory -cd /tmp - -# install qmake (which is needed to configure libembroidery) -sudo apt-get install qt4-qmake - -# get the source for embroidermodder -wget https://github.com/Embroidermodder/Embroidermodder/archive/master.zip -O /tmp/embroidermodder-master.zip - -# unzip files -unzip embroidermodder-master.zip -d /tmp - -# switch into directory of the library we're interested in -cd Embroidermodder-master/libembroidery-convert/ - -# prepare build -qmake - -# build -make - -# create destination folder (which will automatically be in the PATH environment variable) -mkdir -p $HOME/bin/ - -# copy created library there -cp ./libembroidery-convert $HOME/bin/ - -echo "========================== - -Use the embroidery file format conversion tool like this: - -libembroidery-convert file_to_read file_to_write - -To get a list of supported embroidery formats, enter: - -libembroidery-convert --help - -Run this script again to update your libembroidery-convert version." -- cgit v1.2.3 From d994d2506e6d7e1c88fdf72d77600a577be1a08e Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Jul 2018 22:42:59 -0400 Subject: fix pyinstaller error --- bin/build-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/build-dist b/bin/build-dist index 0d435580..79c89838 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -20,7 +20,7 @@ fi pyinstaller_args+="--hidden-import gi.repository.Gtk " # mac and windows build seem to miss wx import -pyinstaller_args+="--hidden-import wx" +pyinstaller_args+="--hidden-import wx " # This lets pyinstaller see inkex.py, etc. pyinstaller_args+="-p inkscape-0.92.3/share/extensions " -- cgit v1.2.3