run in thread while gui active indexed enumerate(self msglistkeepers [msg for (ixmsgin indexed if ix+ not in msgnumsallmsgs savemailseparator join([''keepersfile open(self filename' 'encoding=mailconfig fetchencodingfile write(allmsgsself msglist keepers self hdrlist list(map(self parseheadersself msglist)def ondeletemailfileexit(selfsavetitle)self title(savetitleself fillindex(updates guido in main thread self lift(reset my titleraise my window self openfilebusy decr(def ondeletemailfilefail(selfexc_infosavetitle)showerror(appname'error deleting "% "\ % \ % ((self filename,exc_info[: ])printstack(exc_infoself destroy(always close my windowself openfilebusy decr(not needed if destroy def getmessages(selfmsgnumsafter)""used by view,save,reply,fwdfile load and delete threads may change the msg and hdr listsso disable all other operations that depend on them to be safethis test is for selfsaves also test target file""if self openfilebusyerrmsg 'cannot fetchfile is busy:\ "% "self filename showerror(appnameerrmsgelseafter(mail already loaded def getmessage(selfmsgnum)return self msglist[msgnum- full text of mail def headersmaps(self)return self hdrlist email message message objects def mailsize(selfmsgnum)return len(self msglist[msgnum- ]def quit(self)don' destroy during updatefillindex next if self openfilebusyshowerror(appname'cannot quit during load or delete'elseif askyesno(appname'verify quit window?')delete file from open list del opensavefiles[self filenametoplevel destroy(self the pymailgui client