Split IDE's frame OnCloseFrame() into TryCloseFrame() and OnCloseFrame(), to help further customization
--- a/BeremizIDE.py Wed Jan 09 14:10:07 2019 +0100
+++ b/BeremizIDE.py Fri Jan 25 14:06:11 2019 +0100
@@ -615,11 +615,7 @@
def AddToDoBeforeQuit(self, Thing):
self.ToDoBeforeQuit.append(Thing)
- def OnCloseFrame(self, event):
- for evt_type in [wx.EVT_SET_FOCUS,
- wx.EVT_KILL_FOCUS,
- wx.stc.EVT_STC_UPDATEUI]:
- self.LogConsole.Unbind(evt_type)
+ def TryCloseFrame(self):
if self.CTR is None or self.CheckSaveBeforeClosing(_("Close Application")):
if self.CTR is not None:
self.CTR.KillDebugThread()
@@ -631,8 +627,14 @@
Thing()
self.ToDoBeforeQuit = []
+ return True
+ return False
+
+ def OnCloseFrame(self, event):
+ if self.TryCloseFrame():
event.Skip()
else:
+ # prevent event to continue, i.e. cancel closing
event.Veto()
def RefreshFileMenu(self):