summaryrefslogtreecommitdiff
path: root/lib/gui/simulator.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-05-02 06:50:52 +0200
committerGitHub <noreply@github.com>2024-05-02 06:50:52 +0200
commit04e74c2c8ff727256cd9c4b7bef014a96fb70849 (patch)
treea5dac48fd672d0f35325712a3cb5e0b6de9f7449 /lib/gui/simulator.py
parent5eb243e9ebe5d1061fde9f19d5d2ac9b7ad7ec37 (diff)
cancel simulator extensions without applying changes (#2876)
Diffstat (limited to 'lib/gui/simulator.py')
-rw-r--r--lib/gui/simulator.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gui/simulator.py b/lib/gui/simulator.py
index 79f3d95d..a8e917b4 100644
--- a/lib/gui/simulator.py
+++ b/lib/gui/simulator.py
@@ -1159,6 +1159,7 @@ class SplitSimulatorWindow(wx.Frame):
self.detached_simulator_frame = None
self.splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
background_color = kwargs.pop('background_color', 'white')
+ self.cancel_hook = kwargs.pop('on_cancel', None)
self.simulator_panel = SimulatorPanel(
self.splitter,
background_color=background_color,
@@ -1187,7 +1188,7 @@ class SplitSimulatorWindow(wx.Frame):
wx.CallLater(100, self.set_sash_position)
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.splitter_resize)
- self.Bind(wx.EVT_CLOSE, self.on_close)
+ self.Bind(wx.EVT_CLOSE, self.cancel)
if global_settings['pop_out_simulator']:
self.detach_simulator()
@@ -1201,7 +1202,13 @@ class SplitSimulatorWindow(wx.Frame):
self.splitter.SetSashPosition(settings_panel_min_size.width)
self.statusbar.SetStatusWidths((settings_panel_min_size.width, -1))
- def on_close(self, event):
+ def cancel(self, event=None):
+ if self.cancel_hook:
+ self.cancel_hook()
+ self.close(None)
+
+ def close(self, event=None):
+ self.simulator_panel.stop()
if self.detached_simulator_frame:
self.detached_simulator_frame.Destroy()
self.Destroy()