diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | inx/inkstitch_embroider.inx | 22 | ||||
| -rw-r--r-- | lib/simulator.py | 49 |
3 files changed, 51 insertions, 22 deletions
@@ -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/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/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() |
