From 99e9c22cec3c4377e84865e4fa0b22c39e1011dc Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Mon, 6 Jan 2003 23:15:15 +0100 Subject: [PATCH] /offlineimap/head: changeset 315 Fixed up the VerboseUI for new account system. All that really needed updating with the "Sync immediately" button, to cope with syncing different accounts at different times. It's better now. --- offlineimap/head/offlineimap/ui/Tk.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/offlineimap/head/offlineimap/ui/Tk.py b/offlineimap/head/offlineimap/ui/Tk.py index 9c15c44..5dcc790 100644 --- a/offlineimap/head/offlineimap/ui/Tk.py +++ b/offlineimap/head/offlineimap/ui/Tk.py @@ -16,6 +16,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +from __future__ import nested_scopes + from Tkinter import * import tkFont from threading import * @@ -270,32 +272,39 @@ class VerboseUI(UIBase): b = Button(tf, text = "Exit", command = s.terminate) b.pack(side = RIGHT) + s.sleeping_abort = {} def deletingmessages(s, uidlist, destlist): ds = s.folderlist(destlist) s._msg("Deleting %d messages in %s" % (len(uidlist), ds)) def _sleep_cancel(s, args = None): - s.sleeping_abort = 1 + s.sleeping_abort[thread.get_ident()] = 1 def sleep(s, sleepsecs): - s.sleeping_abort = 0 + threadid = thread.get_ident() + s.sleeping_abort[threadid] = 0 tf = s.gettf().getthreadextraframe() + def sleep_cancel(): + s.sleeping_abort[threadid] = 1 + sleepbut = Button(tf, text = 'Sync immediately', - command = s._sleep_cancel) + command = sleep_cancel) sleepbut.pack() UIBase.sleep(s, sleepsecs) def sleeping(s, sleepsecs, remainingsecs): + retval = s.sleeping_abort[thread.get_ident()] if remainingsecs: s._msg("Next sync in %d:%02d" % (remainingsecs / 60, remainingsecs % 60)) else: s._msg("Wait done; synchronizing now.") s.gettf().destroythreadextraframe() + del s.sleeping_abort[thread.get_ident()] time.sleep(sleepsecs) - return s.sleeping_abort + return retval TkUI = VerboseUI