# HG changeset patch # User Edouard Tisserant # Date 1548421571 -3600 # Node ID 6a7f92b848551c1287d0d5f09419a297d0eef97c # Parent cb53d3bf3380963d8c9c5328d3139dcd661cb97d Split IDE's frame OnCloseFrame() into TryCloseFrame() and OnCloseFrame(), to help further customization diff -r cb53d3bf3380 -r 6a7f92b84855 BeremizIDE.py --- 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):