diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-06-14 09:49:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-14 09:49:57 +0200 |
| commit | dbdba2cda3a66fc42b5bad05e88d33b845a85e2f (patch) | |
| tree | 6d50270e5d687a939ec75c661b1603bc43db1f4e /lib/gui/simulator/simulator_window.py | |
| parent | 39d9defef4a6c813e40df9a8de254af422af6ccd (diff) | |
Add preferences button to simulator (#2992)
* split simulator panel files
* add view panel to position view options at the side
* fix single simulator start size (macOS)
Diffstat (limited to 'lib/gui/simulator/simulator_window.py')
| -rw-r--r-- | lib/gui/simulator/simulator_window.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/gui/simulator/simulator_window.py b/lib/gui/simulator/simulator_window.py new file mode 100644 index 00000000..83321745 --- /dev/null +++ b/lib/gui/simulator/simulator_window.py @@ -0,0 +1,55 @@ +# Authors: see git history +# +# Copyright (c) 2010 Authors +# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. +import wx + +from ...i18n import _ +from . import SimulatorPanel + + +class SimulatorWindow(wx.Frame): + def __init__(self, panel=None, parent=None, **kwargs): + background_color = kwargs.pop('background_color', 'white') + super().__init__(None, title=_("Embroidery Simulation"), **kwargs) + + self.SetWindowStyle(wx.FRAME_FLOAT_ON_PARENT | wx.DEFAULT_FRAME_STYLE) + + self.sizer = wx.BoxSizer(wx.VERTICAL) + + self.statusbar = self.CreateStatusBar(2) + self.statusbar.SetStatusWidths((0, -1)) + + if panel and parent: + self.is_child = True + self.panel = panel + self.parent = parent + self.panel.Reparent(self) + self.sizer.Add(self.panel, 1, wx.EXPAND) + self.panel.Show() + else: + self.is_child = False + self.panel = SimulatorPanel(self, background_color=background_color) + self.sizer.Add(self.panel, 1, wx.EXPAND) + + self.SetSizer(self.sizer) + self.Layout() + + self.SetMinSize(self.sizer.CalcMin()) + + if self.is_child: + self.Bind(wx.EVT_CLOSE, self.on_close) + else: + self.Maximize() + + def detach_simulator_panel(self): + self.sizer.Detach(self.panel) + + def on_close(self, event): + self.parent.attach_simulator() + + def load(self, stitch_plan): + self.panel.load(stitch_plan) + + def go(self): + self.panel.go() |
