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/simulate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/extensions/simulate.py') 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 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/simulate.py') 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 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/simulate.py') 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/simulate.py') 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