]> code.delx.au - offlineimap/commitdiff
/offlineimap/head: changeset 307
authorjgoerzen <jgoerzen>
Sun, 5 Jan 2003 12:01:17 +0000 (13:01 +0100)
committerjgoerzen <jgoerzen>
Sun, 5 Jan 2003 12:01:17 +0000 (13:01 +0100)
Starting to work now.

offlineimap/head/offlineimap/ui/Blinkenlights.py
offlineimap/head/offlineimap/ui/Curses.py
offlineimap/head/offlineimap/ui/UIBase.py

index f5814f52706628eca7e8ec51e0577ccc567cfd11..26a80435634464c878590004340171c061cf1077 100644 (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:
index 3cb372773a1b9cda0d6c2c1c8f3e23b3fa37b14c..54560a04a516128b4ea1ce6b046cc660b20c0cc0 100644 (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()
index 4cc3208c85fc4b66043470509d616958af76ef01..2c317739114957d978cc5cee03063ad917245908 100644 (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):