""msgnums self selectedmsgs(if not msgnumsshowerror(appname'no message selected'elsecaveatdialog warns about replacing file filename self savedialog show(shared class attr if filenamedon' verify num msgs filename os path abspath(filenamenormalize to self getmessages(msgnumsafter=lambdaself contsave(msgnumsfilename)def contsave(selfmsgnumsfilename)test busy nowafter poss srvr msgs load if (filename in opensavefiles keys(and viewing this fileopensavefiles[filenameopenfilebusy)load/del occurringshowerror(appname'target file busy cannot save'elsetrycaveat:not threaded fulltextlist [ use encoding mailfile open(filename' 'encoding=mailconfig fetchencodingfor msgnum in msgnums sec for megs fulltext self getmessage(msgnumbut poss many msgs if fulltext[- !'\ 'fulltext +'\nmailfile write(savemailseparatormailfile write(fulltextfulltextlist append(fulltextmailfile close(exceptshowerror(appname'error during save'printstack(sys exc_info()elsewhy keys()eibti if filename in opensavefiles keys()viewing this filewindow opensavefiles[filenameupdate listraise window addsavedmails(fulltextlistavoid file reload #window loadmailfilethread(this was very slow def onopenmailfile(selffilename=none)process saved mail offline filename filename or self opendialog show(if filenamefilename os path abspath(filenameif filename in opensavefiles keys()opensavefiles[filenamelift(showinfo(appname'file already open'elsefrom pymailgui import pymailfilewindow popup pymailfilewindow(filenameopensavefiles[filenamepopup popup loadmailfilethread(def ondeletemail(self)delete selected mails from server or file msgnums self selectedmsgs( the pymailgui client shared class attr match on full name only win per file raise file' window else deletes odd avoid duplicate win new list window removed in quit try load in thread subclassfillindex