onProgress = self.onLoadHdrsProgress)
def onLoadHdrsExit(self, popup):
self.fillIndex()
popup.quit()
self.lift()
loadingHdrsBusy.decr() # allow other actions to run
def onLoadHdrsFail(self, exc_info, popup):
popup.quit()
showerror(appname, 'Load failed: \n%s\n%s' % exc_info[:2])
printStack(exc_info) # send stack trace to stdout
loadingHdrsBusy.decr()
if exc_info[0] == mailtools.MessageSynchError: # synch inbox/index
self.onLoadServer(forceReload=True) # new thread: reload
else:
self.cache.popPassword = None # force re-input next time
def onLoadHdrsProgress(self, i, n, popup):
popup.changeText('%d of %d' % (i, n))
def doDelete(self, msgnumlist):
"""
threaded: delete from server now - changes msg nums;
may overlap with sends only, disables all except sends;
2.1: cache.deleteMessages now checks TOP result to see
if headers match selected mails, in case msgnums out of
synch with mail server: poss if mail deleted by other client,
or server deletes inbox mail automatically - some ISPs may
move a mail from inbox to undeliverable on load failure;
"""
if loadingHdrsBusy or deletingBusy or loadingMsgsBusy:
showerror(appname, 'Cannot delete during load or delete')
else:
deletingBusy.incr()
popup = popuputil.BusyBoxNowait(appname, 'Deleting selected mails')
threadtools.startThread(
action = self.cache.deleteMessages,
args = (msgnumlist,),
context = (popup,),
onExit = self.onDeleteExit,
onFail = self.onDeleteFail,
onProgress = self.onDeleteProgress)
def onDeleteExit(self, popup):
self.fillIndex() # no need to reload from server
popup.quit() # refill index with updated cache
self.lift() # raise index window, release lock
deletingBusy.decr()
def onDeleteFail(self, exc_info, popup):
popup.quit()
showerror(appname, 'Delete failed: \n%s\n%s' % exc_info[:2])
printStack(exc_info)
deletingBusy.decr() # delete or synch check failure
PyMailGUI Implementation| 1083