new in pyedit supports arbitrary unicode for message parts viewed new in supports unicode/mail encodings for headers in mails sent tbdcould avoid verifying quits unless text area modified (like pyedit )but these windows are largerand would not catch headers already changed tbdshould open dialog in write windows be program-wide(per-window now##############################################################################""from sharednames import program-wide global objects ##############################################################################message view window also superclass of writereplyforward ##############################################################################class viewwindow(windows popupwindowmailtools mailparser)"" toplevelwith extra protocol and embedded texteditorinherits saveparts,partslist from mailtools mailparsermixes in custom subclass logic by direct inheritance here""class attributes modelabel 'viewused in window titles from mailconfig import okaytoopenparts open any attachments at allfrom mailconfig import verifypartopens ask before open each partfrom mailconfig import maxpartbuttons show up to this many from mailconfig import skiptextonhtmlpart just browsernot pyedittemppartdir 'temppartswhere selected part saved all view windows use same dialogremembers last dir partsdialog directory(title=appname 'select parts save directory'def __init__(selfheadermapshowtextorigmessage=none)""header map is origmessageor custom hdr dict for writingshowtext is main text part of the messageparsed or customorigmessage is parsed email message message for view mail windows ""windows popupwindow __init__(selfappnameself modelabelself origmessage origmessage self makewidgets(headermapshowtextdef makewidgets(selfheadermapshowtext)""add headersactionsattachmentstext editor showtext is assumed to be decoded unicode str hereit will be encoded on sends and saves as directed/needed""actionsframe self makeheaders(headermapif self origmessage and self okaytoopenpartsself makepartbuttons(self editor texteditor texteditorcomponentminimal(self the pymailgui client