summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-dist12
-rwxr-xr-xbin/gen-input-inx23
-rwxr-xr-xbin/gen-output-format-option-list21
-rwxr-xr-xbin/gen-output-inx36
-rwxr-xr-xbin/gen-zip-inx35
-rw-r--r--bin/install_libembroidery-convert_Ubuntu.sh58
-rwxr-xr-xbin/pyembroidery-convert6
7 files changed, 95 insertions, 96 deletions
diff --git a/bin/build-dist b/bin/build-dist
index 4d73313a..79c89838 100755
--- a/bin/build-dist
+++ b/bin/build-dist
@@ -19,17 +19,11 @@ 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.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 "
diff --git a/bin/gen-input-inx b/bin/gen-input-inx
index 5f21ce84..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)
- writerState = embFormat_readerState(curFormat)
-
- if writerState.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__":
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)</_option>' % (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</_option>' % (format['extension'], format['description'], format['extension'].upper(), tag)
diff --git a/bin/gen-output-inx b/bin/gen-output-inx
new file mode 100755
index 00000000..fbe2ad55
--- /dev/null
+++ b/bin/gen-output-inx
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import sys, os
+from os.path import dirname
+import pyembroidery
+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 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 pyembroidery_output_formats():
+ inx = template.render(format=format, description=description)
+
+ with open("inx/inkstitch_output_%s.inx" % format.upper(), 'w') as inx_file:
+ print >> inx_file, inx
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx
new file mode 100755
index 00000000..40948786
--- /dev/null
+++ b/bin/gen-zip-inx
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import sys, os
+from os.path import dirname
+import pyembroidery
+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 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=pyembroidery_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/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 <http://www.gnu.org/licenses/>.
-
-#!/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."
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])