I have issue saving(overwrite) the file. the file writes with whitespace per line using this code is the same code using within the dialog is ok whats works perfectly
def FOnSaveFile(self, event):
if os.path.exists(self.filename):#here##
print “exist!”
sve = open(self.path, ‘wt’)
source = self.notebook.GetPage(self.notebook.GetSelection()).GetText()
#self.ConvertTabToSpace(self.notebook.GetPage(self.notebook.GetSelection()).GetText(), 4)
sve.write(source)
sve.close()
self.stbar.SetStatusText(“Overwrite”, 4)
else:
print “doesn’t exist”
self.SaveFileDialog(event)
def SaveFileDialog(self, evt):
dlg = wx.FileDialog(self, “Save File”, ‘.’, ‘’, ‘*.py’, wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
try:
path = dlg.GetPath()
if path == None:
self.stbar.SetStatusText(“Save Failed”, 4)
else:
self.stbar.SetStatusText(“Saved OK!”, 4)
except IOError:
TypeError(log)
fp = open(path, ‘wt’)
#current = self.notebook.GetSelection()
current = self.notebook.GetPage(self.notebook.GetSelection()).GetParent().GetText()#self.editor.GetText()
fp.write(current)
fp.close()
dlg.Destroy()
why happen this?