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}}