From 53de782d3c04b0d9eccb7e2608c9d3b881300646 Mon Sep 17 00:00:00 2001 From: Christophe Kamphaus Date: Sun, 28 Feb 2016 23:24:20 +0100 Subject: [PATCH] Changed default filename to empty string When trying to save a new file it opens the save-as dialog --- gui/Gui/Mainwindow.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gui/Gui/Mainwindow.py b/gui/Gui/Mainwindow.py index 7c7d870..3a9fe74 100644 --- a/gui/Gui/Mainwindow.py +++ b/gui/Gui/Mainwindow.py @@ -60,7 +60,7 @@ class MainWindow(wx.Frame): MainInitOnce() - self.filename = 'noname.spdl' + self.filename = '' self.filepath = "" self.load = False @@ -268,11 +268,14 @@ class MainWindow(wx.Frame): return False def OnSave(self, event): - textfile = open(os.path.join(self.dirname, self.filename), 'w') - textfile.write(self.editor.GetText()) - textfile.close() - self.editor.SetSaved() - return True + if self.filename=='': + return self.OnSaveAs(event) + else: + textfile = open(os.path.join(self.dirname, self.filename), 'w') + textfile.write(self.editor.GetText()) + textfile.close() + self.editor.SetSaved() + return True def OnOpen(self, event): if self.ConfirmLoss("Open"):