summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-09-12 20:51:16 -0400
committerLex Neva <github.com@lexneva.name>2018-09-12 20:51:16 -0400
commitd30507171b04f37871db74609c0a521325bddbd1 (patch)
treeac06f38cde84e676f8aa8e91f08b71d45b9f2642 /lib/extensions
parentd398e10b853840261ddf04dc5fca20a05ad74b51 (diff)
parent3fd741a1a4218b6559184aaadcde8abca178bde2 (diff)
Merge remote-tracking branch 'origin/master' into lexelby/bug-fixes
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/params.py15
-rw-r--r--lib/extensions/simulate.py18
2 files changed, 8 insertions, 25 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py
index 6012263a..784b6be7 100644
--- a/lib/extensions/params.py
+++ b/lib/extensions/params.py
@@ -293,7 +293,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)
@@ -451,7 +450,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.load(stitch_plan)
else:
params_rect = self.GetScreenRect()
simulator_pos = params_rect.GetTopRight()
@@ -460,20 +459,18 @@ 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()
- 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..f962b206 100644
--- a/lib/extensions/simulate.py
+++ b/lib/extensions/simulate.py
@@ -1,8 +1,5 @@
-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,15 +16,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])
-
- frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(1000, 1000), stitch_plan=stitch_plan)
- app.SetTopWindow(frame)
- frame.Show()
- wx.CallAfter(frame.go)
- app.MainLoop()
+ show_simulator(stitch_plan)