from PyMailGuiHelp import showHtmlHelp
showHtmlHelp() # 3.0: HTML version without source file links
def onShowMySource(self, showAsMail=False):
"""
display my sourcecode file, plus imported modules here & elsewhere
"""
import PyMailGui, ListWindows, ViewWindows, SharedNames, textConfig
from PP4E.Internet.Email.mailtools import ( # mailtools now a pkg
mailSender, mailFetcher, mailParser) # can't use * in def
mymods = (
PyMailGui, ListWindows, ViewWindows, SharedNames,
PyMailGuiHelp, popuputil, messagecache, wraplines, html2text,
mailtools, mailFetcher, mailSender, mailParser,
mailconfig, textConfig, threadtools, windows, textEditor)
for mod in mymods:
source = mod.file
if source.endswith('.pyc'):
source = source[:-4] + '.py' # assume a .py in same dir
if showAsMail:
this is a bit cheesey...
code = open(source).read() # 3.0: platform encoding
user = mailconfig.myaddress
hdrmap = {'From': appname, 'To': user, 'Subject': mod.name}
ViewWindow(showtext=code,
headermap=hdrmap,
origmessage=email.message.Message())
else:
more useful PyEdit text editor
4E: assume in UTF8 Unicode encoding (else PeEdit may ask!)
wintitle = ' - ' + mod.name
textEditor.TextEditorMainPopup(self, source, wintitle, 'utf-8')
def onLoadServer(self, forceReload=False):
"""
threaded: load or reload mail headers list on request;
Exit,Fail,Progress run by threadChecker after callback via queue;
load may overlap with sends, but disables all but send;
could overlap with loadingMsgs, but may change msg cache list;
forceReload on delete/synch fail, else loads recent arrivals only;
2.1: cache.loadHeaders may do quick check to see if msgnums
in synch with server, if we are loading just newly arrived hdrs;
"""
if loadingHdrsBusy or deletingBusy or loadingMsgsBusy:
showerror(appname, 'Cannot load headers during load or delete')
else:
loadingHdrsBusy.incr()
self.cache.setPopPassword(appname) # don't update GUI in the thread!
popup = popuputil.BusyBoxNowait(appname, 'Loading message headers')
threadtools.startThread(
action = self.cache.loadHeaders,
args = (forceReload,),
context = (popup,),
onExit = self.onLoadHdrsExit,
onFail = self.onLoadHdrsFail,
1082 | Chapter 14: The PyMailGUI Client