def doExport(self, event):
dlg = wx.FileDialog(self, "Save to file:", ".", "", "Text (*.txt)|*.txt", wx.SAVE|wx.OVERWRITE_PROMPT)
if dlg.ShowModal() == wx.ID_OK:
i = dlg.GetFilterIndex()
if i == 0: # Text format
try:
f = open(dlg.GetPath(), "w")
f.write("# Date, From, SerivceCenter, Message\n")
for i in self.itemDataMap.keys():
entry = self.itemDataMap[i]
f.write('%s,%s,%s,%s\n' % (entry[1], entry[2], entry[4].smsc, entry[3]))
f.close()
pySIMmessage(self, "SMS export to file was successful\n\nFilename: %s" % dlg.GetPath(), "Export OK")
except:
pySIMmessage(self, "Unable to save your SMS messages to file: %s" % dlg.GetPath(), "Export error")
#print_exc()
dlg.Destroy()
评论列表
文章目录