/offlineimap/head: changeset 307

Starting to work now.
This commit is contained in:
jgoerzen 2003-01-05 13:01:17 +01:00
parent 86df6db630
commit c48d8d4fda
3 changed files with 9 additions and 6 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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):