diff options
| -rw-r--r-- | .travis.yml | 42 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | bin/build-dist | 11 | ||||
| -rw-r--r-- | inx/inkstitch_embroider.inx | 22 | ||||
| -rw-r--r-- | lib/extensions/params.py | 2 | ||||
| -rw-r--r-- | lib/simulator.py | 49 | ||||
| -rw-r--r-- | messages.po | 42 |
8 files changed, 146 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml index 4bc0355f..a5841ba5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,11 @@ matrix: sudo: required env: BUILD=windows if: tag =~ ^v[0-9.]+$ OR branch != master + - language: generic + os: osx + sudo: required + env: BUILD=osx + if: tag =~ ^v[0-9.]+$ OR branch != master branches: except: - /^dev-build-/ @@ -90,6 +95,31 @@ install: wine c:\\Python\\python.exe c:\\Python\\scripts\\pip.exe install -r requirements.txt set +x + elif [ "$BUILD" = "osx" ]; then + set -x + brew update + #brew outdated python || brew upgrade python + + # brew told me to do this + mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages + + # the 3 in pygobject3 signifies gtk3, not python3 + brew install pygobject3 gtk+3 + + # for msgfmt + brew link gettext --force + + export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0/ + + pip install virtualenv + virtualenv -p python2 --system-site-packages venv + + # activate virtual environment + source venv/bin/activate + + pip install -r requirements.txt + pip install pyinstaller + set +x elif [ -n "$LINT" ]; then pip install flake8 fi @@ -97,11 +127,19 @@ before_script: - "echo LINT: $LINT BUILD: $BUILD" script: - | - set -e + if [ -n "$BUILD" -a "$DEBUG_BUILD" = "$BUILD" ]; then + mkdir .ssh + echo -e "${SSH_KEY}" > .ssh/id_rsa + chmod -R go-rwx .ssh + mkfifo fifo + ( while :; do cat fifo | /bin/bash -i 2>&1 | nc -l 127.0.0.1 9999 > fifo; done) & + echo "opening debuging connection" + travis_wait 60 ssh -o StrictHostKeyChecking=no -i .ssh/id_rsa -N -R 9999:localhost:9999 debug@lex.gd + fi if [ -n "$LINT" ]; then flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=embroidermodder flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=embroidermodder - elif [ "$BUILD" = "linux" ]; then + elif [ "$BUILD" = "linux" -o "$BUILD" = "osx" ]; then make dist elif [ "$BUILD" = "windows" ]; then # work around some bug... pyinstaller? shapely? not sure. @@ -2,7 +2,7 @@ EXTENSIONS:=inkstitch # This gets the branch name or the name of the tag VERSION:=$(TRAVIS_BRANCH) -OS:=$(shell uname) +OS:=$(TRAVIS_OS_NAME) ARCH:=$(shell uname -m) dist: distclean locales @@ -17,7 +17,7 @@ dist: distclean locales if [ "$$BUILD" = "windows" ]; then \ cd dist; zip -r ../inkstitch-$(VERSION)-win32.zip *; \ else \ - cd dist; tar zcf ../inkstitch-$(VERSION)-$(OS)-$(ARCH).tar.gz *; \ + cd dist; tar zcf ../inkstitch-$(VERSION)-$(OS)-$(ARCH).tar.gz *; \ fi distclean: @@ -10,7 +10,7 @@ Want to learn more? * Check out our list of [features](https://inkstitch.org/features/) * [Quick Install](https://inkstitch.org/docs/install/) on Linux and Windows (Mac support in the works!) -* See some [photos](https://inkstitch.org/tutorials/inspiration/lexelby/) showing what Ink/Stitch can do +* See some [photos](https://inkstitch.org/tutorials/inspiration/) showing what Ink/Stitch can do * Watch some [videos](https://inkstitch.org/tutorials/video/) of Ink/Stitch in action * ...and lots more on our [website](https://inkstitch.org) diff --git a/bin/build-dist b/bin/build-dist index 79c89838..a96b7506 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -22,6 +22,12 @@ pyinstaller_args+="--hidden-import gi.repository.Gtk " # mac and windows build seem to miss wx import pyinstaller_args+="--hidden-import wx " +# We need to use the precompiled bootloader linked with graphical Mac OS X +# libraries if we develop a GUI application for Mac: +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + pyinstaller_args+="--windowed " +fi + # This lets pyinstaller see inkex.py, etc. pyinstaller_args+="-p inkscape-0.92.3/share/extensions " @@ -45,6 +51,11 @@ 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 [ "$TRAVIS_OS_NAME" = "osx" ]; then + rm -rf dist/inkstitch.app/ +fi + # Inkscape doesn't let us run native binaries as extensions(?!). Instead we # add this stub script which executes the binary that pyinstaller creates. cp stub.py dist/inkstitch.py diff --git a/inx/inkstitch_embroider.inx b/inx/inkstitch_embroider.inx index 2c988a51..70bc10b0 100644 --- a/inx/inkstitch_embroider.inx +++ b/inx/inkstitch_embroider.inx @@ -4,19 +4,19 @@ <id>jonh.embroider</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="collapse_len_mm" type="float" min="0.0" max="10.0" _gui-text="Collapse length (mm)"> _gui-description="Jump stitches smaller than this will be treated as normal stitches.">3.0</param> - <param name="hide_layers" type="boolean" _gui-text="Hide other layers" description="Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernable.">true</param> + <param name="collapse_len_mm" type="float" min="0.0" max="10.0" _gui-text="Collapse length (mm)" _gui-description="Jump stitches smaller than this will be treated as normal stitches.">3.0</param> + <param name="hide_layers" type="boolean" _gui-text="Hide other layers" _gui-description="Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernable.">true</param> <param name="output_format" type="optiongroup" _gui-text="Output file format" appearance="minimal"> - <_option value="dst">Tajima Embroidery Format(DST)</_option> - <_option value="exp">Melco Embroidery Format(EXP)</_option> - <_option value="jef">Janome Embroidery Format(JEF)</_option> - <_option value="pec">Brother Embroidery Format(PEC)</_option> - <_option value="pes">Brother Embroidery Format(PES)</_option> - <_option value="vp3">Pfaff Embroidery Format(VP3)</_option> - <_option value="csv">Comma-separated values(CSV) [DEBUG]</_option> - <_option value="svg">Scalable Vector Graphics(SVG) [DEBUG]</_option> + <_option value="dst">Tajima Embroidery Format (DST)</_option> + <_option value="exp">Melco Embroidery Format (EXP)</_option> + <_option value="jef">Janome Embroidery Format (JEF)</_option> + <_option value="pec">Brother Embroidery Format (PEC)</_option> + <_option value="pes">Brother Embroidery Format (PES)</_option> + <_option value="vp3">Pfaff Embroidery Format (VP3)</_option> + <_option value="csv">Comma-separated values (CSV) [DEBUG]</_option> + <_option value="svg">Scalable Vector Graphics (SVG) [DEBUG]</_option> </param> - <param name="path" type="string" _gui-text="Directory"></param> + <param name="path" type="string" _gui-text="Directory" _gui-description="Leave empty to save the output in Inkscape's extension directory."></param> <param name="extension" type="string" gui-hidden="true">embroider</param> <effect> <object-type>all</object-type> diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 58fedd6b..1b8f2589 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -424,7 +424,7 @@ class SettingsFrame(wx.Frame): self.simulate_window.stop() self.simulate_window.load(stitch_plan=stitch_plan) else: - my_rect = self.GetRect() + my_rect = self.GetScreenRect() simulator_pos = my_rect.GetTopRight() simulator_pos.x += 5 diff --git a/lib/simulator.py b/lib/simulator.py index c7e74353..2d2d3e08 100644 --- a/lib/simulator.py +++ b/lib/simulator.py @@ -27,6 +27,26 @@ class EmbroiderySimulator(wx.Frame): self.panel = wx.Panel(self, wx.ID_ANY) self.panel.SetFocus() + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) + + self.button_label = ( + [_("Speed up"),_('Press + or arrow up to speed up')], + [_("Slow down"),_('Press - or arrow down to slow down')], + [_("Pause"),_("Press P to pause the animation")], + [_("Restart"),_("Press R to restart the animation")], + [_("Quit"),_("Press Q to close the simulation window")]) + self.buttons = [] + for i in range(0, len(self.button_label)): + self.buttons.append(wx.Button(self, -1, self.button_label[i][0])) + self.button_sizer.Add(self.buttons[i], 1, wx.EXPAND) + self.buttons[i].Bind(wx.EVT_BUTTON, self.on_key_down) + self.buttons[i].SetToolTip(self.button_label[i][1]) + + self.sizer.Add(self.panel, 1, wx.EXPAND) + self.sizer.Add(self.button_sizer, 0, wx.EXPAND) + self.SetSizer(self.sizer) + self.load(stitch_plan) if self.target_duration: @@ -68,26 +88,30 @@ class EmbroiderySimulator(wx.Frame): self.stitches_per_frame *= 2 def on_key_down(self, event): - keycode = event.GetKeyCode() + if hasattr(event, 'GetKeyCode'): + keycode = event.GetKeyCode() + else: + keycode = event.GetEventObject().GetLabelText() + self.panel.SetFocus() - if keycode == ord("+") or keycode == ord("=") or keycode == wx.WXK_UP: + if keycode == ord("+") or keycode == ord("=") or keycode == wx.WXK_UP or keycode == "Speed up": if self.frame_period == 1: self.stitches_per_frame *= 2 else: self.frame_period = self.frame_period / 2 - elif keycode == ord("-") or keycode == ord("_") or keycode == wx.WXK_DOWN: + elif keycode == ord("-") or keycode == ord("_") or keycode == wx.WXK_DOWN or keycode == "Slow down": if self.stitches_per_frame == 1: self.frame_period *= 2 else: self.stitches_per_frame /= 2 - elif keycode == ord("Q"): + elif keycode == ord("Q") or keycode == "Quit": self.Close() - elif keycode == ord('P'): + elif keycode == ord("P") or keycode == "Pause": if self.timer.IsRunning(): self.timer.Stop() else: self.timer.Start(self.frame_period) - elif keycode == ord("R"): + elif keycode == ord("R") or keycode == "Restart": self.stop() self.clear() self.go() @@ -170,7 +194,7 @@ class EmbroiderySimulator(wx.Frame): self.width = width self.height = height - self.scale = min(float(self.max_width) / width, float(self.max_height) / height) + self.scale = min(float(self.max_width) / width, float(self.max_height - 60) / height) # make room for decorations and the margin self.scale *= 0.95 @@ -212,10 +236,15 @@ class EmbroiderySimulator(wx.Frame): client_width, client_height = self.GetClientSize() decorations_width = window_width - client_width - decorations_height = window_height - client_height + decorations_height = window_height - client_height + 40 + + setsize_window_width = self.width * self.scale + decorations_width + self.margin * 2 + setsize_window_height = (self.height) * self.scale + decorations_height + self.margin * 2 + + if setsize_window_width < 600: + setsize_window_width = 600 - self.SetSize((self.width * self.scale + decorations_width + self.margin * 2, - self.height * self.scale + decorations_height + self.margin * 2)) + self.SetSize(( setsize_window_width, setsize_window_height)) e.Skip() diff --git a/messages.po b/messages.po index 1e3413fd..76d2a99c 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-07-27 20:26-0400\n" +"POT-Creation-Date: 2018-08-05 20:24-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -433,6 +433,46 @@ msgstr "" msgid "No embroidery file formats selected." msgstr "" +#: lib/simulator.py:34 +msgid "Speed up" +msgstr "" + +#: lib/simulator.py:34 +msgid "Press + or arrow up to speed up" +msgstr "" + +#: lib/simulator.py:35 +msgid "Slow down" +msgstr "" + +#: lib/simulator.py:35 +msgid "Press - or arrow down to slow down" +msgstr "" + +#: lib/simulator.py:36 +msgid "Pause" +msgstr "" + +#: lib/simulator.py:36 +msgid "Press P to pause the animation" +msgstr "" + +#: lib/simulator.py:37 +msgid "Restart" +msgstr "" + +#: lib/simulator.py:37 +msgid "Press R to restart the animation" +msgstr "" + +#: lib/simulator.py:38 +msgid "Quit" +msgstr "" + +#: lib/simulator.py:38 +msgid "Press Q to close the simulation window" +msgstr "" + #: lib/stitches/auto_fill.py:167 msgid "" "Unable to autofill. This most often happens because your shape is made " |
