From faf6c57069980c97bb267fe08c7b8bdca9a25c81 Mon Sep 17 00:00:00 2001 From: Christophe Kamphaus Date: Sun, 28 Feb 2016 23:33:18 +0100 Subject: [PATCH] Added a new-file command with standard new-file keyboard shortcut --- gui/Gui/Mainwindow.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gui/Gui/Mainwindow.py b/gui/Gui/Mainwindow.py index 3a9fe74..0e99167 100644 --- a/gui/Gui/Mainwindow.py +++ b/gui/Gui/Mainwindow.py @@ -159,6 +159,7 @@ class MainWindow(wx.Frame): def CreateMenus(self): menuBar = wx.MenuBar() self.CreateMenu(menuBar, '&File', [ + (wx.ID_NEW, '&New\tCTRL-N', 'Create a new file', self.OnNew), (wx.ID_OPEN, '&Open\tCTRL-O', 'Open a new file', self.OnOpen), (wx.ID_SAVE, '&Save\tCTRL-S', 'Save the current file', self.OnSave), (wx.ID_SAVEAS, 'Save &As', 'Save the file under a different name', @@ -267,6 +268,14 @@ class MainWindow(wx.Frame): return True return False + def OnNew(self, event): + if self.ConfirmLoss("Open"): + self.editor.SetText('') + self.filename = '' + self.editor.SetOpened() + return True + return False + def OnSave(self, event): if self.filename=='': return self.OnSaveAs(event)