diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-01-09 17:06:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-09 17:06:07 +0100 |
| commit | ca02ac5b015dd64ebe3d13b8cc2021535a369161 (patch) | |
| tree | 9c3d63dd71be5dcc3fcb253a041236482c54b5e4 /lib/gui/simulator/control_panel.py | |
| parent | b8f5241755466b2432f89a11c2d5ccdf5a9ae3f2 (diff) | |
save and reload simulator speed (optionally) (#3420)
Diffstat (limited to 'lib/gui/simulator/control_panel.py')
| -rw-r--r-- | lib/gui/simulator/control_panel.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gui/simulator/control_panel.py b/lib/gui/simulator/control_panel.py index e0efcd79..9226d5de 100644 --- a/lib/gui/simulator/control_panel.py +++ b/lib/gui/simulator/control_panel.py @@ -11,6 +11,7 @@ from wx.lib.intctrl import IntCtrl from ...debug.debug import debug from ...i18n import _ from ...utils import get_resource_dir +from ...utils.settings import global_settings from . import SimulatorSlider @@ -31,7 +32,7 @@ class ControlPanel(wx.Panel): self.drawing_panel = None self.num_stitches = 0 self.current_stitch = 0 - self.speed = 1 + self.speed = global_settings['simulator_speed'] self.direction = 1 self._last_color_block_end = 0 @@ -203,6 +204,9 @@ class ControlPanel(wx.Panel): return icon.ConvertToBitmap() def choose_speed(self): + if not global_settings['simulator_adaptive_speed']: + self.set_speed(global_settings['simulator_speed']) + return if self.target_duration: self.set_speed(int(self.num_stitches / float(self.target_duration))) else: @@ -225,6 +229,7 @@ class ControlPanel(wx.Panel): self.animation_reverse() def set_speed(self, speed): + global_settings['simulator_speed'] = speed self.speed = int(max(speed, 1)) self.update_speed_text() @@ -251,6 +256,7 @@ class ControlPanel(wx.Panel): if self.current_stitch != stitch: self.current_stitch = stitch self.slider.SetValue(stitch) + stitch = min(self.stitchBox.GetMax(), stitch) self.stitchBox.SetValue(stitch) def on_stitch_box_focus(self, event): |
