def onLoadMail():
    # load all pop email
    getpassword()
    win = modalinfobox('Retrieving mail')
    global msgList
    try:
        msgList = pymail.loadmessages(mailserver, mailuser, mailpswd)
    except:
        excinfo = '\n' + str(sys.exc_type) + '\n' + str(sys.exc_value)
        showerror('PyMail', 'Error loading mail\n' + excinfo)
    fillIndex(msgList)
    win.destroy()
def onLoadMail():
    # load all pop email
    getpassword()
    win = modalinfobox('Retrieving mail')
    global msgList
    try:
        msgList = pymail.loadmessages(mailserver, mailuser, mailpswd)
    except:
        excinfo = '\n' + str(sys.exc_type) + '\n' + str(sys.exc_value)
        showerror('PyMail', 'Error loading mail\n' + excinfo)
    fillIndex(msgList)
    win.destroy()
def onLoadMail():
    # load all (or new) pop email
    getpassword()
    win = modalstart("Retrieving mail")
    global msgList
    try:
        nextnum = len(msgList) + 1
        newmail = pymail.loadmessages(mailserver, mailuser, mailpswd, nextnum)
        msgList = msgList + newmail
    except:
        excinfo = "\n" + str(sys.exc_type) + "\n" + str(sys.exc_value)
        showerror("PyMail", "Error loading mail\n" + excinfo)
    fillIndex(msgList)
    modalstop(win)
def loadMailThread():
    # load mail while main thread handles gui events
    global msgList, errInfo, threadExitVar
    print "load start"
    errInfo = ""
    try:
        nextnum = len(msgList) + 1
        newmail = pymail.loadmessages(mailserver, mailuser, mailpswd, nextnum)
        msgList = msgList + newmail
    except:
        exc_type, exc_value = sys.exc_info()[:2]  # thread exc
        errInfo = "\n" + str(exc_type) + "\n" + str(exc_value)
    print "load exit"
    threadExitVar = 1  # signal main thread
def loadMailThread():
    # load mail while main thread handles gui events
    global msgList, errInfo, threadExitVar
    print 'load start'
    errInfo = ''
    try:
        nextnum = len(msgList) + 1
        newmail = pymail.loadmessages(mailserver, mailuser, mailpswd, nextnum)
        msgList = msgList + newmail
    except:
        exc_type, exc_value = sys.exc_info()[:2]  # thread exc
        errInfo = '\n' + str(exc_type) + '\n' + str(exc_value)
    print 'load exit'
    threadExitVar = 1  # signal main thread