From 29106f9bddb303dc6128a97cf7eccf53024e9043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Tue, 24 Sep 2019 18:08:49 +0200 Subject: [PATCH] Prompt to save changes on application exit. --- libroar/RoarClient.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libroar/RoarClient.py b/libroar/RoarClient.py index cc3572a..31afeef 100644 --- a/libroar/RoarClient.py +++ b/libroar/RoarClient.py @@ -31,6 +31,10 @@ class RoarClient(GuiFrame): def onMouseWheel(self, event): self.canvasPanel.GetEventHandler().ProcessEvent(event) + def onClose(self, event): + if self.canvasPanel.commands._promptSaveChanges(): + event.Skip(); + def onSize(self, event): self.canvasPanel.SetMinSize(self.GetSize()); self.canvasPanel.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.GetSize()); event.Skip(); @@ -58,6 +62,7 @@ class RoarClient(GuiFrame): self.canvasPanel.commands.canvasClearRecent.attrDict["id"] = wx.NewId() menuItemWindow = self.canvasPanel.commands.canvasOpenRecent.attrDict["menu"].Append(self.canvasPanel.commands.canvasClearRecent.attrDict["id"], self.canvasPanel.commands.canvasClearRecent.attrDict["label"], self.canvasPanel.commands.canvasClearRecent.attrDict["caption"]) self.canvasPanel.commands.canvasOpenRecent.attrDict["menu"].Bind(wx.EVT_MENU, self.canvasPanel.commands.canvasClearRecent, menuItemWindow) + self.Bind(wx.EVT_CLOSE, self.onClose) self.Bind(wx.EVT_SIZE, self.onSize) # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120