##############################################################################main frame general structure for both file and server message lists ##############################################################################class pymailcommon(mailtools mailparser)""an abstract widget packagewith main mail listboxmixed in with tktoplevelor frame by top-level window classesmust be customized in mode-specific subclass with actions(and othercreates view and write windows on demandthey serve as mailsenders""class attrs shared by all list windows threadloopstarted false started by first window queuecheckspersecond tweak if cpu use too high queuedelay /queuecheckspersecond min msecs between timer events queuebatch max callbacks per timer event all windows use same dialogsremember last dirs opendialog open(title=appname 'open mail file'savedialog saveas(title=appname 'append mail file' avoid downloading (fetchingsame message in parallel beingfetched set(def __init__(self)self makewidgets(if not pymailcommon threadloopstarteddraw my contentslist,tools start thread exit check loop timer event loop that dispatches queued gui callbacksjust one loop for all windowsserver,file,views can all threadself is tktoplevel,or frameany widget type will sufficeeadded queue delay/batch for progress speedup~ /secpymailcommon threadloopstarted true threadtools threadchecker(selfself queuedelayself queuebatchdef makewidgets(self)add all/none checkbtn at bottom tools frame(selfrelief=sunkenbd= cursor='hand ' configs tools pack(side=bottomfill=xself allmodevar intvar(chk checkbutton(toolstext="all"chk config(variable=self allmodevarcommand=self oncheckallchk pack(side=rightadd main buttons at bottom toolbar for (titlecallbackin self actions()if not callbacksep label(toolstext=titlesep pack(side=leftexpand=yesfill=both separator expands with window pymailgui implementation