def OnClose(self, event): if self._allowed_to_exit(): perspective = self._mgr.SavePerspective() self._application.settings.set('AUI Perspective', perspective) PUBLISHER.unsubscribe(self._set_label, RideTreeSelection) RideClosing().publish() # deinitialize the frame manager self._mgr.UnInit() self.Destroy() else: wx.CloseEvent.Veto(event)
def OnClose(self, event): if self._allowed_to_exit(): perspective = self._mgr.SavePerspective() self._application.settings.set('AUI Perspective', perspective) PUBLISHER.unsubscribe(self._set_label, RideTreeSelection) RideClosing().publish() # deinitialize the frame manager self._mgr.UnInit() self._task_bar_icon.Destroy() self.Destroy() app = wx.GetApp() if app is not self._application: # other wx app instance created unexpectedly # this will cause RIDE app instance cannot invoke ExitMainLoop properly self._application.ExitMainLoop() else: wx.CloseEvent.Veto(event)