From a1440903cb91f3effd7cd23a395dbe3f8f9bed00 Mon Sep 17 00:00:00 2001 From: Momo Date: Mon, 20 Aug 2018 18:28:52 +0200 Subject: update slider maxValue when params have changed --- lib/extensions/params.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index c464e044..ce06cf2c 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -287,7 +287,6 @@ class ParamsTab(ScrolledPanel): summary_box = wx.StaticBox(self, wx.ID_ANY, label=_("Inkscape objects")) sizer = wx.StaticBoxSizer(summary_box, wx.HORIZONTAL) -# sizer = wx.BoxSizer(wx.HORIZONTAL) self.description = wx.StaticText(self) self.update_description() self.description.SetLabel(self.description_text) @@ -423,6 +422,12 @@ class SettingsFrame(wx.Frame): if self.simulate_window: self.simulate_window.stop() self.simulate_window.load(stitch_plan=stitch_plan) + + children = self.simulate_window.GetChildren() + for child in children: + if isinstance(child, wx.Slider): + child.Destroy() + self.simulate_window.set_slider() else: params_rect = self.GetScreenRect() simulator_pos = params_rect.GetTopRight() -- cgit v1.2.3 From 505388a9c1f16f351e353061e0588543fd96c824 Mon Sep 17 00:00:00 2001 From: Momo Date: Wed, 22 Aug 2018 19:24:53 +0200 Subject: fix jumping timeline and remove symbols --- lib/extensions/params.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index ce06cf2c..4b21d1dc 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -428,6 +428,9 @@ class SettingsFrame(wx.Frame): if isinstance(child, wx.Slider): child.Destroy() self.simulate_window.set_slider() + + self.simulate_window.Layout() + self.simulate_window.Refresh() else: params_rect = self.GetScreenRect() simulator_pos = params_rect.GetTopRight() -- cgit v1.2.3 From 56e153e87187a6bdad99faebc43253dfc40d4588 Mon Sep 17 00:00:00 2001 From: Momo Date: Thu, 23 Aug 2018 12:48:41 +0200 Subject: merge forward/backward/speed --- lib/extensions/params.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 4b21d1dc..a77c96f1 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -422,6 +422,7 @@ class SettingsFrame(wx.Frame): if self.simulate_window: self.simulate_window.stop() self.simulate_window.load(stitch_plan=stitch_plan) + self.simulate_window.calculate_dimensions() children = self.simulate_window.GetChildren() for child in children: -- cgit v1.2.3 From c5bd1878846c17309c99ad7554d4645088de9629 Mon Sep 17 00:00:00 2001 From: Momo Date: Sat, 25 Aug 2018 10:57:17 +0200 Subject: * seperated controls * one frame movements --- lib/extensions/params.py | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index a77c96f1..6d1464a3 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -431,7 +431,6 @@ class SettingsFrame(wx.Frame): self.simulate_window.set_slider() self.simulate_window.Layout() - self.simulate_window.Refresh() else: params_rect = self.GetScreenRect() simulator_pos = params_rect.GetTopRight() -- cgit v1.2.3 From a355af287484a62a021808b4ced20c4b85877759 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 26 Aug 2018 15:02:51 -0400 Subject: handle window size and target duration --- lib/extensions/params.py | 11 ++++------- lib/extensions/simulate.py | 4 +++- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 6d1464a3..9bde2a66 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -440,19 +440,16 @@ class SettingsFrame(wx.Frame): display = wx.Display(current_screen) screen_rect = display.GetClientArea() - max_width = screen_rect.GetWidth() - params_rect.GetWidth() - max_height = screen_rect.GetHeight() + width = screen_rect.GetWidth() - params_rect.GetWidth() + height = screen_rect.GetHeight() try: self.simulate_window = EmbroiderySimulator(None, -1, _("Preview"), simulator_pos, - size=(300, 300), - x_position=simulator_pos.x, + size=(width, height), stitch_plan=stitch_plan, on_close=self.simulate_window_closed, - target_duration=5, - max_width=max_width, - max_height=max_height) + target_duration=5) except: error = traceback.format_exc() diff --git a/lib/extensions/simulate.py b/lib/extensions/simulate.py index 38f86156..2e414ac6 100644 --- a/lib/extensions/simulate.py +++ b/lib/extensions/simulate.py @@ -25,8 +25,10 @@ class Simulate(InkstitchExtension): screen_rect = display.GetClientArea() simulator_pos = (screen_rect[0], screen_rect[1]) + width = screen_rect[2] + height = screen_rect[3] - frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(1000, 1000), stitch_plan=stitch_plan) + frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(width, height), stitch_plan=stitch_plan) app.SetTopWindow(frame) frame.Show() wx.CallAfter(frame.go) -- cgit v1.2.3 From e854df43073ce3158654b0db304edd0bba7a7d6d Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 26 Aug 2018 15:34:13 -0400 Subject: handle auto-refresh from Params --- lib/extensions/params.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 9bde2a66..73ce069d 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -421,16 +421,7 @@ class SettingsFrame(wx.Frame): stitch_plan = patches_to_stitch_plan(patches) if self.simulate_window: self.simulate_window.stop() - self.simulate_window.load(stitch_plan=stitch_plan) - self.simulate_window.calculate_dimensions() - - children = self.simulate_window.GetChildren() - for child in children: - if isinstance(child, wx.Slider): - child.Destroy() - self.simulate_window.set_slider() - - self.simulate_window.Layout() + self.simulate_window.load(stitch_plan) else: params_rect = self.GetScreenRect() simulator_pos = params_rect.GetTopRight() -- cgit v1.2.3 From b3516785aafef79a02059cf29591ec978331e703 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 26 Aug 2018 16:14:03 -0400 Subject: automatically scale and center the design --- lib/extensions/simulate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/simulate.py b/lib/extensions/simulate.py index 2e414ac6..dcb5e604 100644 --- a/lib/extensions/simulate.py +++ b/lib/extensions/simulate.py @@ -25,11 +25,12 @@ class Simulate(InkstitchExtension): screen_rect = display.GetClientArea() simulator_pos = (screen_rect[0], screen_rect[1]) - width = screen_rect[2] - height = screen_rect[3] + + # subtract 1 because otherwise the window becomes maximized on Linux + width = screen_rect[2] - 1 + height = screen_rect[3] - 1 frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(width, height), stitch_plan=stitch_plan) app.SetTopWindow(frame) frame.Show() - wx.CallAfter(frame.go) app.MainLoop() -- cgit v1.2.3 From 8d196ace7fb01d2ac011d1c685ff422ef891320c Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 27 Aug 2018 16:43:23 -0400 Subject: position params's simulator window at the top of the screen --- lib/extensions/params.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/extensions') diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 73ce069d..c9c994c9 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -430,6 +430,7 @@ class SettingsFrame(wx.Frame): current_screen = wx.Display.GetFromPoint(wx.GetMousePosition()) display = wx.Display(current_screen) screen_rect = display.GetClientArea() + simulator_pos.y = screen_rect.GetTop() width = screen_rect.GetWidth() - params_rect.GetWidth() height = screen_rect.GetHeight() -- cgit v1.2.3 From 3fe3399d909de6549a7ce64f4347b342933b2465 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 1 Sep 2018 13:35:47 -0400 Subject: simulator standalone mode --- lib/extensions/simulate.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/simulate.py b/lib/extensions/simulate.py index dcb5e604..e23d391b 100644 --- a/lib/extensions/simulate.py +++ b/lib/extensions/simulate.py @@ -1,8 +1,6 @@ -import wx - from .base import InkstitchExtension from ..i18n import _ -from ..simulator import EmbroiderySimulator +from ..simulator import show_simulator from ..stitch_plan import patches_to_stitch_plan @@ -19,18 +17,4 @@ class Simulate(InkstitchExtension): return patches = self.elements_to_patches(self.elements) stitch_plan = patches_to_stitch_plan(patches) - app = wx.App() - current_screen = wx.Display.GetFromPoint(wx.GetMousePosition()) - display = wx.Display(current_screen) - screen_rect = display.GetClientArea() - - simulator_pos = (screen_rect[0], screen_rect[1]) - - # subtract 1 because otherwise the window becomes maximized on Linux - width = screen_rect[2] - 1 - height = screen_rect[3] - 1 - - frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(width, height), stitch_plan=stitch_plan) - app.SetTopWindow(frame) - frame.Show() - app.MainLoop() + show_simulator(stitch_plan) -- cgit v1.2.3 From 9360e9b9304a6b9a50c5586a04ebf0a13859d5fe Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 1 Sep 2018 14:22:46 -0400 Subject: fix code style --- lib/extensions/simulate.py | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/extensions') diff --git a/lib/extensions/simulate.py b/lib/extensions/simulate.py index e23d391b..f962b206 100644 --- a/lib/extensions/simulate.py +++ b/lib/extensions/simulate.py @@ -1,5 +1,4 @@ from .base import InkstitchExtension -from ..i18n import _ from ..simulator import show_simulator from ..stitch_plan import patches_to_stitch_plan -- cgit v1.2.3