don' refetch viewed msgs if hdrs list same or extendedretains cached msgs after delete unless delete fails does quick check to see if msgnums still in sync this is now subject to mailconfig fetchlimit max""if forcereloadsloadfrom self msglist [msg nums have changed elseloadfrom len(self msglist)+ continue from last load only if loading newly arrived if loadfrom ! self checksyncherror(self allhdrs()raises except if bad get all or newly arrived msgs reply self downloadallheaders(progressloadfromheaderslistmsgsizesloadedfull reply for (hdrssizein zip(headerslistmsgsizes)newmsg messageinfo(hdrssizeif loadedfullzip result may be empty newmsg fulltext hdrs got full msg if no 'topself msglist append(newmsgdef getmessage(selfmsgnum)cacheobj self msglist[msgnum- if not cacheobj fulltextfulltext self downloadmessage(msgnumcacheobj fulltext fulltext return cacheobj fulltext get raw msg text add to cache if fetched harmless if threaded simpler coding def getmessages(selfmsgnumsprogress=none)""prefetch full raw text of multiple messagesin thread does quick check to see if msgnums still in syncwe can' get here unless the index list already loaded""self checksyncherror(self allhdrs()raises except if bad nummsgs len(msgnumsadds messages to cache for (ixmsgnumin enumerate(msgnums)some poss already there if progressprogress(ix+ nummsgsonly connects if needed self getmessage(msgnumbut may connect once def getsize(selfmsgnum)return self msglist[msgnum- fullsize encapsulate cache struct it changed once alreadydef isloaded(selfmsgnum)return self msglist[msgnum- fulltext def allhdrs(self)return [msg hdrtext for msg in self msglistdef deletemessages(selfmsgnumsprogress=none)pymailgui implementation