From c48d8d4fda85be16418bfad337b553ef745a7a44 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Sun, 5 Jan 2003 13:01:17 +0100 Subject: [PATCH] /offlineimap/head: changeset 307 Starting to work now. --- offlineimap/head/offlineimap/ui/Blinkenlights.py | 1 + offlineimap/head/offlineimap/ui/Curses.py | 2 +- offlineimap/head/offlineimap/ui/UIBase.py | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/offlineimap/head/offlineimap/ui/Blinkenlights.py b/offlineimap/head/offlineimap/ui/Blinkenlights.py index f5814f5..26a8043 100644 --- a/offlineimap/head/offlineimap/ui/Blinkenlights.py +++ b/offlineimap/head/offlineimap/ui/Blinkenlights.py @@ -17,6 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from threading import * +from offlineimap.ui.UIBase import UIBase import thread class BlinkenBase: diff --git a/offlineimap/head/offlineimap/ui/Curses.py b/offlineimap/head/offlineimap/ui/Curses.py index 3cb3727..54560a0 100644 --- a/offlineimap/head/offlineimap/ui/Curses.py +++ b/offlineimap/head/offlineimap/ui/Curses.py @@ -231,7 +231,7 @@ class Blinkenlights(BlinkenBase, UIBase): try: s.gettf().setcolor('white') s._addline_unlocked(" *** Input Required", s.gettf().getcolor()) - s._addline_unlocked(" *** Please enter password for account %s: ", accountname, + s._addline_unlocked(" *** Please enter password for account %s: " % accountname, s.gettf().getcolor()) s.logwindow.refresh() password = s.logwindow.getstr() diff --git a/offlineimap/head/offlineimap/ui/UIBase.py b/offlineimap/head/offlineimap/ui/UIBase.py index 4cc3208..2c31773 100644 --- a/offlineimap/head/offlineimap/ui/UIBase.py +++ b/offlineimap/head/offlineimap/ui/UIBase.py @@ -54,19 +54,21 @@ class UIBase: def registerthread(s, account): """Provides a hint to UIs about which account this particular thread is processing.""" - if s.threadaccounts.has_key(thread.get_ident()): + if s.threadaccounts.has_key(threading.currentThread()): raise ValueError, "Thread already registered (old %s, new %s)" % \ (s.getthreadaccount(s), account) - s.threadaccounts[thread.get_ident()] = account + s.threadaccounts[threading.currentThread()] = account def unregisterthread(s, thr): """Recognizes a thread has exited.""" if s.threadaccounts.has_key(thr): del s.threadaccounts[thr] - def getthreadaccount(s): - if s.threadaccounts.has_key(thread.get_ident()): - return s.threadaccounts[thread.get_ident()] + def getthreadaccount(s, thr = None): + if not thr: + thr = threading.currentThread() + if s.threadaccounts.has_key(thr): + return s.threadaccounts[thr] return None def debug(s, debugtype, msg): -- 2.39.2