From e84a86d4ac0caf29d6074728376ff0a594243fec Mon Sep 17 00:00:00 2001
From: Kaalleen <36401965+kaalleen@users.noreply.github.com>
Date: Thu, 4 Mar 2021 18:40:53 +0100
Subject: [PATCH] Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch
Co-authored-by: Lex Neva
---
.github/workflows/build.yml | 129 +++++++++---------
.gitignore | 1 +
Makefile | 8 +-
bin/build-distribution-archives | 10 +-
bin/build-python | 5 -
bin/generate-version-file | 10 ++
bin/inkstitch-fonts-gettext | 8 +-
bin/pyembroidery-gettext | 4 +-
.../.electron-vue/webpack.renderer.config.js | 18 ++-
electron/.electron-vue/webpack.web.config.js | 18 ++-
electron/src/lib/i18n.js | 28 +++-
electron/src/main/index.js | 2 -
electron/src/renderer/assets/js/simulator.js | 2 +-
.../src/renderer/assets/style/simulator.css | 28 +++-
.../src/renderer/components/Simulator.vue | 6 +-
electron/src/renderer/main.js | 2 +-
icons/inkstitch_colour_logo.svg | 27 ++++
inkstitch.py | 30 ++--
lib/api/install.py | 2 +-
lib/api/server.py | 9 +-
lib/api/stitch_plan.py | 4 +-
lib/commands.py | 88 ++++++------
lib/debug.py | 37 ++---
lib/elements/__init__.py | 22 +--
lib/elements/auto_fill.py | 28 +++-
lib/elements/clone.py | 73 ++--------
lib/elements/element.py | 56 ++++----
lib/elements/fill.py | 6 +
lib/elements/image.py | 14 +-
lib/elements/polyline.py | 7 +-
lib/elements/satin_column.py | 47 ++++---
lib/elements/stroke.py | 10 +-
lib/elements/svg_objects.py | 71 ----------
lib/elements/text.py | 14 +-
lib/extensions/__init__.py | 57 ++++----
lib/extensions/auto_satin.py | 4 +-
lib/extensions/base.py | 45 ++----
lib/extensions/break_apart.py | 12 +-
lib/extensions/cleanup.py | 19 ++-
lib/extensions/commands.py | 4 +-
lib/extensions/convert_to_satin.py | 35 +++--
lib/extensions/cut_satin.py | 6 +-
lib/extensions/embroider.py | 87 ------------
lib/extensions/embroider_settings.py | 17 +++
lib/extensions/flip.py | 9 +-
lib/extensions/import_threadlist.py | 19 +--
lib/extensions/input.py | 11 +-
lib/extensions/layer_commands.py | 30 ++--
lib/extensions/lettering.py | 82 ++++++-----
lib/extensions/lettering_custom_font_dir.py | 48 +++++++
lib/extensions/lettering_generate_json.py | 76 +++++++++++
lib/extensions/lettering_remove_kerning.py | 30 ++++
lib/extensions/object_commands.py | 2 +-
lib/extensions/output.py | 10 +-
lib/extensions/params.py | 38 +++---
lib/extensions/print_pdf.py | 35 +++--
lib/extensions/remove_embroidery_settings.py | 20 +--
lib/extensions/reorder.py | 36 +++++
lib/extensions/stitch_plan_preview.py | 9 +-
lib/extensions/troubleshoot.py | 27 ++--
lib/extensions/zip.py | 34 ++---
lib/gui/electron.py | 4 +-
lib/gui/presets.py | 4 +-
lib/gui/simulator.py | 26 ++--
lib/i18n.py | 4 +-
lib/inx/__init__.py | 2 +-
lib/inx/about.py | 7 +
lib/inx/extensions.py | 11 +-
lib/inx/generate.py | 4 +-
lib/inx/info.py | 9 ++
lib/inx/inputs.py | 2 +-
lib/inx/outputs.py | 13 +-
lib/inx/utils.py | 31 +++--
lib/lettering/__init__.py | 2 +-
lib/lettering/font.py | 44 +++---
lib/lettering/font_variant.py | 22 ++-
lib/lettering/glyph.py | 31 +++--
lib/lettering/kerning.py | 69 ++++++++++
lib/output.py | 7 +-
lib/stitch_plan/stitch_plan.py | 4 +-
lib/stitches/__init__.py | 6 +-
lib/stitches/auto_fill.py | 15 +-
lib/stitches/auto_satin.py | 29 ++--
lib/stitches/fill.py | 5 +-
lib/stitches/running_stitch.py | 2 +-
lib/svg/guides.py | 8 +-
lib/svg/path.py | 29 ++--
lib/svg/rendering.py | 59 ++++----
lib/svg/svg.py | 3 +-
lib/svg/tags.py | 5 +-
lib/svg/units.py | 25 +++-
lib/threads/__init__.py | 6 +-
lib/threads/catalog.py | 2 +-
lib/threads/color.py | 9 +-
lib/threads/palette.py | 5 +-
lib/utils/dotdict.py | 2 +-
lib/utils/geometry.py | 6 +-
lib/utils/inkscape.py | 4 +-
lib/utils/io.py | 22 +--
lib/utils/version.py | 17 +++
print/resources/inkstitch.js | 4 +-
print/resources/style.css | 3 +-
print/templates/operator_detailedview.html | 2 +-
pyembroidery | 2 +-
requirements.txt | 14 +-
templates/about.xml | 28 ++++
templates/{auto_satin.inx => auto_satin.xml} | 0
.../{break_apart.inx => break_apart.xml} | 0
templates/{cleanup.inx => cleanup.xml} | 0
...vert_to_satin.inx => convert_to_satin.xml} | 0
templates/{cut_satin.inx => cut_satin.xml} | 0
templates/embroider.inx | 28 ----
templates/embroider.xml | 18 +++
templates/embroider_settings.xml | 21 +++
templates/{flip.inx => flip.xml} | 0
...lobal_commands.inx => global_commands.xml} | 0
...t_threadlist.inx => import_threadlist.xml} | 4 +-
templates/{input.inx => input.xml} | 0
templates/{install.inx => install.xml} | 2 +-
...{layer_commands.inx => layer_commands.xml} | 0
templates/{lettering.inx => lettering.xml} | 2 +-
templates/lettering_custom_font_dir.xml | 26 ++++
templates/lettering_generate_json.xml | 46 +++++++
templates/lettering_remove_kerning.xml | 28 ++++
...bject_commands.inx => object_commands.xml} | 0
templates/{output.inx => output.xml} | 2 +-
templates/output_params_txt.xml | 2 +-
templates/{params.inx => params.xml} | 2 +-
templates/{print.inx => print.xml} | 2 +-
...ngs.inx => remove_embroidery_settings.xml} | 0
templates/reorder.xml | 15 ++
templates/{simulator.inx => simulator.xml} | 2 +-
...an_preview.inx => stitch_plan_preview.xml} | 0
.../{troubleshoot.inx => troubleshoot.xml} | 0
templates/{zip.inx => zip.xml} | 4 +-
135 files changed, 1435 insertions(+), 1003 deletions(-)
create mode 100755 bin/generate-version-file
create mode 100644 icons/inkstitch_colour_logo.svg
delete mode 100644 lib/elements/svg_objects.py
delete mode 100644 lib/extensions/embroider.py
create mode 100644 lib/extensions/embroider_settings.py
create mode 100644 lib/extensions/lettering_custom_font_dir.py
create mode 100644 lib/extensions/lettering_generate_json.py
create mode 100644 lib/extensions/lettering_remove_kerning.py
create mode 100644 lib/extensions/reorder.py
create mode 100755 lib/inx/about.py
create mode 100755 lib/inx/info.py
create mode 100644 lib/lettering/kerning.py
create mode 100644 lib/utils/version.py
create mode 100644 templates/about.xml
rename templates/{auto_satin.inx => auto_satin.xml} (100%)
rename templates/{break_apart.inx => break_apart.xml} (100%)
rename templates/{cleanup.inx => cleanup.xml} (100%)
rename templates/{convert_to_satin.inx => convert_to_satin.xml} (100%)
rename templates/{cut_satin.inx => cut_satin.xml} (100%)
delete mode 100644 templates/embroider.inx
create mode 100644 templates/embroider.xml
create mode 100644 templates/embroider_settings.xml
rename templates/{flip.inx => flip.xml} (100%)
rename templates/{global_commands.inx => global_commands.xml} (100%)
rename templates/{import_threadlist.inx => import_threadlist.xml} (75%)
rename templates/{input.inx => input.xml} (100%)
rename templates/{install.inx => install.xml} (92%)
rename templates/{layer_commands.inx => layer_commands.xml} (100%)
rename templates/{lettering.inx => lettering.xml} (92%)
create mode 100644 templates/lettering_custom_font_dir.xml
create mode 100644 templates/lettering_generate_json.xml
create mode 100644 templates/lettering_remove_kerning.xml
rename templates/{object_commands.inx => object_commands.xml} (100%)
rename templates/{output.inx => output.xml} (93%)
rename templates/{params.inx => params.xml} (92%)
rename templates/{print.inx => print.xml} (93%)
rename templates/{remove_embroidery_settings.inx => remove_embroidery_settings.xml} (100%)
create mode 100644 templates/reorder.xml
rename templates/{simulator.inx => simulator.xml} (93%)
rename templates/{stitch_plan_preview.inx => stitch_plan_preview.xml} (100%)
rename templates/{troubleshoot.inx => troubleshoot.xml} (100%)
rename templates/{zip.inx => zip.xml} (89%)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 76f221a99..0da74dee2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,156 +10,149 @@ jobs:
linux:
runs-on: ubuntu-16.04
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: recursive
+ - uses: actions/setup-python@v2
+ with:
+ python-version: '3.9'
- uses: actions/setup-node@v1
with:
- node-version: '11.x'
- - name: download dependencies
- shell: bash
- run: |
- curl -sOL https://inkscape.org/en/gallery/item/12187/inkscape-0.92.3.tar.bz2
+ node-version: '15.x'
+
+ - uses: actions/cache@v2
+ id: pip-cache
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-16.04-pip-${{ hashFiles('**/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-16.04-pip-
+
+ - name: Get yarn cache directory path
+ id: yarn-cache-dir-path
+ run: echo "::set-output name=dir::$(yarn cache dir)"
+
+ - uses: actions/cache@v2
+ id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
+ with:
+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-yarn-
+
- name: install dependencies
shell: bash
run: |
- # I'd love to use a setup-python action but it seems to give a
- # python that doesn't support unicode. See:
- # https://github.com/actions/setup-python/issues/23
-
sudo apt-get update
-
- sudo apt-get install python2.7
python -m pip install --upgrade pip
+ python -m pip install wheel
sudo apt-get install gettext
# for wxPython
- sudo apt-get install glib-networking libsdl1.2-dev
+ sudo apt install glib-networking libsdl1.2-dev
# for PyGObject
- sudo apt install libgirepository1.0-dev
+ sudo apt install libgirepository1.0-dev libcairo2-dev
# for shapely
- sudo apt install libgeos-dev
+ sudo apt install libgeos-dev build-essential libgtk-3-dev
uname -a
python --version
python -m pip --version
python -m pip debug
- # wxPython doen't publish linux wheels in pypi
- wget -q https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04/wxPython-4.0.6-cp27-cp27mu-linux_x86_64.whl
- python -m pip install wxPython*.whl
+ python -m pip install pycairo==1.11.1
+ python -m pip install PyGObject==3.30.5
- python -m pip install PyGObject
+ # colormath - last official release: 3.0.0
+ # we need already submitted fixes - so let's grab them from the github repository
+ python -m pip install git+https://github.com/gtaylor/python-colormath
python -m pip install -r requirements.txt
- python -m pip install pyinstaller==3.3.1
+ python -m pip install pyinstaller
- tar -jxf inkscape-0.92.3.tar.bz2
- rm inkscape-0.92.3.tar.bz2
- mv inkscape-0.92.3 inkscape
-
echo "${{ env.pythonLocation }}\bin" >> $GITHUB_PATH
- shell: bash
run: |
make dist
env:
BUILD: linux
- - uses: actions/upload-artifact@master
+ - uses: actions/upload-artifact@v2
with:
name: inkstitch-linux
path: artifacts
windows:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-node@v1
with:
- node-version: '11.x'
- - uses: actions/setup-python@v1
+ node-version: '15.x'
+ - uses: actions/setup-python@v2
with:
- python-version: '2.7.x'
+ python-version: '3.9'
architecture: 'x86'
- uses: microsoft/setup-msbuild@v1.0.2
- - name: download dependencies
- shell: bash
- run: |
- curl -sOL https://github.com/lexelby/inkstitch-build-objects/releases/download/v1.0.0/Shapely-1.6.3-cp27-cp27m-win32.whl
- curl -sOL https://inkscape.org/en/gallery/item/12187/inkscape-0.92.3.tar.bz2
- name: install dependencies
shell: bash
run: |
- pip install Shapely-1.6.3-cp27-cp27m-win32.whl
- pip install -r requirements.txt
- pip install pyinstaller==3.3.1
+ python -m pip install --upgrade pip
+ python -m pip install wheel
- # Just using tar -j freezes forever with no output. Heck if I know why. This seems to work.
- bzcat inkscape-0.92.3.tar.bz2 | tar -vxf -
- rm inkscape-0.92.3.tar.bz2
- mv inkscape-0.92.3 inkscape
+ python -m pip install git+https://github.com/gtaylor/python-colormath
+
+ python -m pip install -r requirements.txt
+ python -m pip install pyinstaller
echo "${{ env.pythonLocation }}\bin" >> $GITHUB_PATH
- - name: fix geos
- shell: bash
- run: |
- cd "${{ env.pythonLocation }}\Lib/site-packages/shapely/DLLs"
- cp geos_c.dll geos.dll
- shell: bash
run: |
make dist
env:
BUILD: windows
- - uses: actions/upload-artifact@master
+ - uses: actions/upload-artifact@v2
with:
name: inkstitch-windows
path: artifacts
mac:
runs-on: macos-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: recursive
+ - uses: actions/setup-python@v2
+ with:
+ python-version: '3.9'
- uses: actions/setup-node@v1
with:
- node-version: '11.x'
- - uses: actions/setup-python@v1
- with:
- python-version: '2.7.x'
- - uses: actions/setup-node@v1
- with:
- node-version: '10.x'
- - name: download inkscape
- shell: bash
- run: |
- curl -sOL https://inkscape.org/en/gallery/item/12187/inkscape-0.92.3.tar.bz2
+ node-version: '15.x'
- name: install dependencies
shell: bash
run: |
brew update
- # this errors because it installs python3 but python2 is already installed
- brew install gtk+3 pkg-config gobject-introspection libffi gettext || true
+ brew install gtk+3 pkg-config gobject-introspection geos libffi gettext || true
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
-
+
# for msgfmt
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
echo "GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0/" >> $GITHUB_ENV
+ pip install --upgrade pip
pip --version
+ pip install wheel
pip install PyGObject
+ pip install git+https://github.com/gtaylor/python-colormath
+
pip install -r requirements.txt
- pip install pyinstaller==3.3.1
-
- tar -jxf inkscape-0.92.3.tar.bz2
- rm inkscape-0.92.3.tar.bz2
- mv inkscape-0.92.3 inkscape
+ pip install pyinstaller
echo "${{ env.pythonLocation }}/bin" >> $GITHUB_PATH
- shell: bash
@@ -167,7 +160,7 @@ jobs:
make dist
env:
BUILD: osx
- - uses: actions/upload-artifact@master
+ - uses: actions/upload-artifact@v2
with:
name: inkstitch-mac
path: artifacts
diff --git a/.gitignore b/.gitignore
index 4ff89f902..09f99873b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ locales/
/debug.log
/debug.svg
/.idea
+/VERSION
diff --git a/Makefile b/Makefile
index b5bbd4e58..3253a570f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-dist: locales inx
+dist: version locales inx
bash bin/build-python
bash bin/build-electron
bash bin/build-distribution-archives
@@ -8,7 +8,7 @@ distclean:
rm -rf build dist inx locales *.spec *.tar.gz *.zip electron/node_modules electron/dist
.PHONY: inx
-inx: locales
+inx: version locales
mkdir -p inx
python bin/generate-inx-files; \
@@ -49,6 +49,10 @@ locales:
mkdir -p locales; \
fi
+.PHONY: version
+version:
+ bash bin/generate-version-file
+
.PHONY: style
style:
flake8 . --count --max-complexity=10 --max-line-length=150 --statistics --exclude=pyembroidery,__init__.py,electron,build
diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives
index 6e11818d2..6402122b8 100755
--- a/bin/build-distribution-archives
+++ b/bin/build-distribution-archives
@@ -4,12 +4,14 @@ VERSION="$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e
OS="${BUILD:-$(uname)}"
ARCH="$(uname -m)"
-cp -a images/examples palettes symbols fonts dist/inkstitch
-cp -a icons locales print dist/inkstitch/bin
-
if [ "$BUILD" = "osx" ]; then
- cp -a electron/build/mac dist/inkstitch/electron
+ cp -a images/examples palettes symbols fonts LICENSE VERSION dist/inkstitch.app/Contents
+ cp -a icons locales print dist/inkstitch.app/Contents/MacOS
+ cp -a electron/build/mac dist/inkstitch.app/Contents/electron
+ rm -rf dist/inkstitch/
else
+ cp -a images/examples palettes symbols fonts LICENSE VERSION dist/inkstitch
+ cp -a icons locales print dist/inkstitch/bin
cp -a electron/build/*-unpacked dist/inkstitch/electron
fi
diff --git a/bin/build-python b/bin/build-python
index 0dd3e0a03..88e166aea 100755
--- a/bin/build-python
+++ b/bin/build-python
@@ -52,8 +52,3 @@ shopt -s dotglob
mkdir dist/bin
mv dist/inkstitch/* dist/bin
mv dist/bin dist/inkstitch
-
-# on Mac, pyinstaller creates a .app version as well, but we don't need that
-if [ "$BUILD" = "osx" ]; then
- rm -rf dist/inkstitch.app/
-fi
diff --git a/bin/generate-version-file b/bin/generate-version-file
new file mode 100755
index 000000000..36c70944c
--- /dev/null
+++ b/bin/generate-version-file
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+VERSION="${GITHUB_REF##*/}"
+OS="${BUILD:-$(uname)}"
+
+if [[ "$VERSION" == "" ]]; then
+ VERSION="Manual Install"
+fi
+
+echo "${VERSION} (${OS})" > VERSION
diff --git a/bin/inkstitch-fonts-gettext b/bin/inkstitch-fonts-gettext
index 8b802fee3..24fb9fdf5 100755
--- a/bin/inkstitch-fonts-gettext
+++ b/bin/inkstitch-fonts-gettext
@@ -12,8 +12,8 @@ for font in sorted(os.listdir(fonts_dir)):
with open(os.path.join(fonts_dir, font, "font.json")) as font_json:
font_metadata = json.load(font_json)
- print "# L10N name of font in fonts/%s" % font
- print "_(%s)" % repr(font_metadata.get("name", ""))
+ print("# L10N name of font in fonts/%s" % font)
+ print("_(%s)" % repr(font_metadata.get("name", "")))
- print "# L10N description of font in fonts/%s" % font
- print "_(%s)" % repr(font_metadata.get("description", ""))
+ print("# L10N description of font in fonts/%s" % font)
+ print("_(%s)" % repr(font_metadata.get("description", "")))
diff --git a/bin/pyembroidery-gettext b/bin/pyembroidery-gettext
index ac9bd1ab5..f4e844b95 100755
--- a/bin/pyembroidery-gettext
+++ b/bin/pyembroidery-gettext
@@ -6,5 +6,5 @@ import pyembroidery
# generate fake python code containing the descriptions of pyembroidery formats
# as gettext calls so that pybabel will extract them into messages.po
for format in pyembroidery.supported_formats():
- print "# L10N description for pyembroidery file format: %s" % format['extension']
- print "_(%s)" % repr(format['description'])
+ print("# L10N description for pyembroidery file format: %s" % format['extension'])
+ print("_(%s)" % repr(format['description']))
diff --git a/electron/.electron-vue/webpack.renderer.config.js b/electron/.electron-vue/webpack.renderer.config.js
index 89f8cd783..ac281db65 100644
--- a/electron/.electron-vue/webpack.renderer.config.js
+++ b/electron/.electron-vue/webpack.renderer.config.js
@@ -103,12 +103,6 @@ let rendererConfig = {
'css-loader',
{
loader: 'sass-loader',
- // Requires sass-loader@^7.0.0
- options: {
- implementation: require('sass'),
- fiber: require('fibers'),
- indentedSyntax: true // optional
- },
// Requires sass-loader@^8.0.0
options: {
implementation: require('sass'),
@@ -132,6 +126,18 @@ let rendererConfig = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
+ templateParameters(compilation, assets, options) {
+ return {
+ compilation: compilation,
+ webpack: compilation.getStats().toJson(),
+ webpackConfig: compilation.options,
+ htmlWebpackPlugin: {
+ files: assets,
+ options: options
+ },
+ process
+ }
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/electron/.electron-vue/webpack.web.config.js b/electron/.electron-vue/webpack.web.config.js
index 913518a25..50a73df6e 100644
--- a/electron/.electron-vue/webpack.web.config.js
+++ b/electron/.electron-vue/webpack.web.config.js
@@ -77,12 +77,6 @@ let webConfig = {
'css-loader',
{
loader: 'sass-loader',
- // Requires sass-loader@^7.0.0
- options: {
- implementation: require('sass'),
- fiber: require('fibers'),
- indentedSyntax: true // optional
- },
// Requires sass-loader@^8.0.0
options: {
implementation: require('sass'),
@@ -102,6 +96,18 @@ let webConfig = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
+ templateParameters(compilation, assets, options) {
+ return {
+ compilation: compilation,
+ webpack: compilation.getStats().toJson(),
+ webpackConfig: compilation.options,
+ htmlWebpackPlugin: {
+ files: assets,
+ options: options
+ },
+ process
+ }
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/electron/src/lib/i18n.js b/electron/src/lib/i18n.js
index 886fd654e..4f9395d71 100644
--- a/electron/src/lib/i18n.js
+++ b/electron/src/lib/i18n.js
@@ -1,9 +1,27 @@
-module.exports.selectLanguage = function () {
- ['LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'].forEach(language => {
+module.exports.selectLanguage = function (translations) {
+ // get a list of available translations
+ var availableTranslations = ['en_US'];
+ for(var k in translations) availableTranslations.push(k);
+
+ var lang = undefined;
+
+ // get system language / Inkscape language
+ ['LANG', 'LC_MESSAGES', 'LC_ALL', 'LANGUAGE'].forEach(language => {
if (process.env[language]) {
- return process.env[language].split(":")[0]
+ // split encoding information, we don't need it
+ var current_lang = process.env[language].split(".")[0];
+ if (current_lang.length == 2) {
+ // current language has only two letters (e.g. en),
+ // compare with available languages and if present, set to a long locale name (e.g. en_US)
+ lang = availableTranslations.find(elem => elem.startsWith(current_lang));
+ } else {
+ lang = current_lang;
+ }
}
})
-
- return "en_US"
+ // set default language
+ if (lang === undefined) {
+ lang = "en_US"
+ }
+ return lang
}
diff --git a/electron/src/main/index.js b/electron/src/main/index.js
index f7fb9437c..14a3da55e 100644
--- a/electron/src/main/index.js
+++ b/electron/src/main/index.js
@@ -61,9 +61,7 @@ function createWindow() {
app.on('ready', createWindow)
app.on('window-all-closed', () => {
- if (process.platform !== 'darwin') {
app.quit()
- }
})
app.on('activate', () => {
diff --git a/electron/src/renderer/assets/js/simulator.js b/electron/src/renderer/assets/js/simulator.js
index 638f0ca23..6c251a59b 100644
--- a/electron/src/renderer/assets/js/simulator.js
+++ b/electron/src/renderer/assets/js/simulator.js
@@ -126,7 +126,7 @@ export default {
return ""
}
- let label = "STITCH"
+ let label = this.$gettext("STITCH")
switch (true) {
case stitch.jump:
label = this.$gettext("JUMP")
diff --git a/electron/src/renderer/assets/style/simulator.css b/electron/src/renderer/assets/style/simulator.css
index 7da1d9ef4..30e601b08 100644
--- a/electron/src/renderer/assets/style/simulator.css
+++ b/electron/src/renderer/assets/style/simulator.css
@@ -20,7 +20,18 @@
}
button {
- color: rgb(0, 51, 153)
+ color: rgb(0, 51, 153);
+ align-items: flex-start;
+ text-align: center;
+ cursor: default;
+ background-color: buttonface;
+ box-sizing: border-box;
+ padding: 2px 6px 3px;
+ border-width: 2px;
+ border-style: outset;
+ border-color: buttonface;
+ border-image: initial;
+ margin-bottom: 5px;
}
.fa-spin-fast {
@@ -59,11 +70,13 @@ button {
text-align: center;
flex: 1;
white-space: nowrap;
+ margin: 0 5px;
}
fieldset {
border: 2px solid rgb(0, 51, 153);
position: relative;
+ padding: 0 5px
}
.window-controls {
@@ -142,6 +155,10 @@ fieldset.show-commands {
text-align: left;
}
+fieldset.show-commands legend {
+ text-align: center;
+}
+
fieldset.show-commands span {
display: inline-block;
vertical-align: top;
@@ -152,7 +169,7 @@ fieldset.show-commands span.npp {
}
fieldset.show-commands span:first-of-type {
- padding-right: 12px;
+ padding: 0 5px;
}
button.pressed {
@@ -164,8 +181,7 @@ button.pressed {
}
.slider-container {
- margin-top: 25px;
- margin-bottom: 25px;
+ margin: 25px 5px;
flex-grow: 0;
}
@@ -244,12 +260,15 @@ button.pressed {
width: 4rem;
float: right;
font-size: 1rem;
+ border-style: inset;
+ padding: 0 3px;
}
.simulator {
display: flex;
flex-direction: column;
height: 95vh;
+ margin: 10px;
}
.current-command {
@@ -269,6 +288,7 @@ div.simulator::v-deep svg.simulation {
div.simulator::v-deep svg.simulation-scale {
height: 50px;
order: -1;
+ margin-left: 5px;
}
div.simulator::v-deep .simulation-scale-label {
diff --git a/electron/src/renderer/components/Simulator.vue b/electron/src/renderer/components/Simulator.vue
index c6a190fbf..66abadd60 100644
--- a/electron/src/renderer/components/Simulator.vue
+++ b/electron/src/renderer/components/Simulator.vue
@@ -189,7 +189,9 @@
{{currentCommand}}
{{ _('Total stops') }}: {{ job.num_stops }}
diff --git a/pyembroidery b/pyembroidery
index c0b817d06..d23ead189 160000
--- a/pyembroidery
+++ b/pyembroidery
@@ -1 +1 @@
-Subproject commit c0b817d0626140221e707e88be571728c393a3ca
+Subproject commit d23ead18908706a5db2365441d4bef6884e99ba9
diff --git a/requirements.txt b/requirements.txt
index 3bf490a68..84ba47d0b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,19 +1,19 @@
./pyembroidery
+inkex
backports.functools_lru_cache
-wxPython==4.0.6
-networkx==2.2
-shapely==1.6.3
+wxPython
+networkx
+shapely
lxml
appdirs
-numpy<1.16.0
+numpy<=1.17.4
jinja2>2.9
requests
colormath
stringcase
tinycss2
-
-# We're not ready for flask 1.0 yet. Logging changed, among othe things.
-flask==0.*
+flask
+fonttools
pywinutils; sys.platform == 'win32'
pywin32; sys.platform == 'win32'
diff --git a/templates/about.xml b/templates/about.xml
new file mode 100644
index 000000000..68609d95e
--- /dev/null
+++ b/templates/about.xml
@@ -0,0 +1,28 @@
+
+
+ {% trans %}About{% endtrans %}
+ org.inkstitch.about.{{ locale }}
+
+
+ {{ image_path }}inkstitch_colour_logo.svg
+
+
+
+
+
+
+
+
+
+{{ inkstitch_license }}
+
+
+
+
+ all
+
+
+
+
+
+
diff --git a/templates/auto_satin.inx b/templates/auto_satin.xml
similarity index 100%
rename from templates/auto_satin.inx
rename to templates/auto_satin.xml
diff --git a/templates/break_apart.inx b/templates/break_apart.xml
similarity index 100%
rename from templates/break_apart.inx
rename to templates/break_apart.xml
diff --git a/templates/cleanup.inx b/templates/cleanup.xml
similarity index 100%
rename from templates/cleanup.inx
rename to templates/cleanup.xml
diff --git a/templates/convert_to_satin.inx b/templates/convert_to_satin.xml
similarity index 100%
rename from templates/convert_to_satin.inx
rename to templates/convert_to_satin.xml
diff --git a/templates/cut_satin.inx b/templates/cut_satin.xml
similarity index 100%
rename from templates/cut_satin.inx
rename to templates/cut_satin.xml
diff --git a/templates/embroider.inx b/templates/embroider.inx
deleted file mode 100644
index b79c2f5fb..000000000
--- a/templates/embroider.inx
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- {% trans %}Embroider{% endtrans %}
- org.inkstitch.embroider.{{ locale }}
- 3.0
- true
-
- {% for format, description in formats %}
- <_option value="{{ format }}">{{ _(description) }} ({{ format | upper }})
- {% endfor %}
- {% for format, description in debug_formats %}
- <_option value="{{ format }}">{{ _(description) }} ({{ format | upper }}) [{{ _("DEBUG") }}]
- {% endfor %}
-
-
- embroider
-
- all
-
-
-
-
-
-
-
-
diff --git a/templates/embroider.xml b/templates/embroider.xml
new file mode 100644
index 000000000..ff56ac7d6
--- /dev/null
+++ b/templates/embroider.xml
@@ -0,0 +1,18 @@
+
+
+ {% trans %}Embroider{% endtrans %}
+ org.inkstitch.embroider.{{ locale }}
+ {% trans %}Create a stitch file{% endtrans %}
+ {% trans %}Save your embroidery file through | File > Save a Copy ... |{% endtrans %}
+ {% trans %}Choose from listed embroidery file formats and save.{% endtrans %}
+
+ {% trans %}Multiple file formats can be saved by choosing the zip file format.{% endtrans %}
+
+ all
+
+
+
+
+
+
+
diff --git a/templates/embroider_settings.xml b/templates/embroider_settings.xml
new file mode 100644
index 000000000..51ce9d16e
--- /dev/null
+++ b/templates/embroider_settings.xml
@@ -0,0 +1,21 @@
+
+
+ {% trans %}Settings{% endtrans %}
+ org.inkstitch.embroider_settings.{{ locale }}
+ embroider_settings
+
+ all
+
+
+
+
+
+ {% trans %}Output Settings{% endtrans %}
+
+ 3
+
+
diff --git a/templates/flip.inx b/templates/flip.xml
similarity index 100%
rename from templates/flip.inx
rename to templates/flip.xml
diff --git a/templates/global_commands.inx b/templates/global_commands.xml
similarity index 100%
rename from templates/global_commands.inx
rename to templates/global_commands.xml
diff --git a/templates/import_threadlist.inx b/templates/import_threadlist.xml
similarity index 75%
rename from templates/import_threadlist.inx
rename to templates/import_threadlist.xml
index 081a881a6..5db963b6b 100644
--- a/templates/import_threadlist.inx
+++ b/templates/import_threadlist.xml
@@ -3,9 +3,7 @@
{% trans %}Import Threadlist{% endtrans %}
org.inkstitch.import_threadlist.{{ locale }}
import_threadlist
-
- {{ _("Enter path to file") }}
+
diff --git a/templates/input.inx b/templates/input.xml
similarity index 100%
rename from templates/input.inx
rename to templates/input.xml
diff --git a/templates/install.inx b/templates/install.xml
similarity index 92%
rename from templates/install.inx
rename to templates/install.xml
index ffcb9b7b3..764027b83 100644
--- a/templates/install.inx
+++ b/templates/install.xml
@@ -3,7 +3,7 @@
{% trans %}Install thread color palettes for Inkscape{% endtrans %}
org.inkstitch.install.{{ locale }}
install
-
+
all
diff --git a/templates/layer_commands.inx b/templates/layer_commands.xml
similarity index 100%
rename from templates/layer_commands.inx
rename to templates/layer_commands.xml
diff --git a/templates/lettering.inx b/templates/lettering.xml
similarity index 92%
rename from templates/lettering.inx
rename to templates/lettering.xml
index 65eee8a11..6dea9e93e 100644
--- a/templates/lettering.inx
+++ b/templates/lettering.xml
@@ -3,7 +3,7 @@
{% trans %}Lettering{% endtrans %}
org.inkstitch.lettering.{{ locale }}
lettering
-
+
all
diff --git a/templates/lettering_custom_font_dir.xml b/templates/lettering_custom_font_dir.xml
new file mode 100644
index 000000000..b08c37d6a
--- /dev/null
+++ b/templates/lettering_custom_font_dir.xml
@@ -0,0 +1,26 @@
+
+
+ {% trans %}Custom font directory{% endtrans %}
+ org.inkstitch.lettering_custom_font_dir.{{ locale }}
+ lettering_custom_font_dir
+
+ all
+
+
+
+
+
+
+
+ {% trans %}Set a custom directory for additional fonts to be used with the lettering tool.{% endtrans %}
+
+
+
+
+
+ {% trans %}Usage: Create a subdirectory for each font you add.{% endtrans %}
+
+
+
diff --git a/templates/lettering_generate_json.xml b/templates/lettering_generate_json.xml
new file mode 100644
index 000000000..5f4907f78
--- /dev/null
+++ b/templates/lettering_generate_json.xml
@@ -0,0 +1,46 @@
+
+
+ {% trans %}Generate JSON{% endtrans %}
+ org.inkstitch.lettering_generate_json.{{ locale }}
+ lettering_generate_json
+
+ all
+
+
+
+
+
+
+
+ {% trans %}Generates font.json which can be used by the lettering tool.{% endtrans %}
+
+
+
+
+
+
+
+
+ {% trans %}Insert a font SVG file with kerning information.{% endtrans %}
+
+
+
+
+ true
+ true
+
+ �
+
+
+ 1
+ 1
+
+
+
+
+
+
diff --git a/templates/lettering_remove_kerning.xml b/templates/lettering_remove_kerning.xml
new file mode 100644
index 000000000..5657e003b
--- /dev/null
+++ b/templates/lettering_remove_kerning.xml
@@ -0,0 +1,28 @@
+
+
+ {% trans %}Remove Kerning{% endtrans %}
+ org.inkstitch.lettering_remove_kerning.{{ locale }}
+ lettering_remove_kerning
+
+ all
+
+
+
+
+
+
+
+ {% trans %}Removes Kerning information from given SVG files{% endtrans %}
+
+
+
+ ⚠ {% trans %}Make sure you keep a copy of the original file. After running this extension kerning information will be lost unrevertably from these files.{% endtrans %}
+
+
+
+
+
+
+
diff --git a/templates/object_commands.inx b/templates/object_commands.xml
similarity index 100%
rename from templates/object_commands.inx
rename to templates/object_commands.xml
diff --git a/templates/output.inx b/templates/output.xml
similarity index 93%
rename from templates/output.inx
rename to templates/output.xml
index ffff4be97..545c3d286 100644
--- a/templates/output.inx
+++ b/templates/output.xml
@@ -4,7 +4,7 @@
org.inkstitch.output.{{ format }}.{{ locale }}
- {%- for format, description in formats %}
+ {%- for format, description, mimetype, category in formats %}
+ {%- if category == "embroidery" %}
false
+ {%- endif %}
{%- endfor %}
false
false