]> code.delx.au - offlineimap/blobdiff - offlineimap/ui/Curses.py
Merge commit 'origin' into v7
[offlineimap] / offlineimap / ui / Curses.py
index 0163c8da2aa11cbefbc715011c847e0d46abd78f..6c24ab317e4ee67ffa9fb14a7a4c225d9ffdd925 100644 (file)
@@ -14,7 +14,7 @@
 #
 #    You should have received a copy of the GNU General Public License
 #    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 from Blinkenlights import BlinkenBase
 from UIBase import UIBase
@@ -126,10 +126,11 @@ class CursesUtil:
         self.start()
 
 class CursesAccountFrame:
-    def __init__(s, master, accountname):
+    def __init__(s, master, accountname, ui):
         s.c = master
         s.children = []
         s.accountname = accountname
+        s.ui = ui
 
     def drawleadstr(s, secs = None):
         if secs == None:
@@ -150,7 +151,7 @@ class CursesAccountFrame:
             s.location += 1
 
     def getnewthreadframe(s):
-        tf = CursesThreadFrame(s.c, s.window, 0, s.location)
+        tf = CursesThreadFrame(s.c, s.ui, s.window, 0, s.location)
         s.location += 1
         s.children.append(tf)
         return tf
@@ -180,9 +181,10 @@ class CursesAccountFrame:
         s.sleeping_abort = 1
 
 class CursesThreadFrame:
-    def __init__(s, master, window, y, x):
+    def __init__(s, master, ui, window, y, x):
         """master should be a CursesUtil object."""
         s.c = master
+        s.ui = ui
         s.window = window
         s.x = x
         s.y = y
@@ -212,7 +214,7 @@ class CursesThreadFrame:
             if self.getcolor() == 'black':
                 self.window.addstr(self.y, self.x, ' ', self.color)
             else:
-                self.window.addstr(self.y, self.x, '.', self.color)
+                self.window.addstr(self.y, self.x, self.ui.config.getdefault("ui.Curses.Blinkenlights", "statuschar", '.'), self.color)
             self.c.stdscr.move(self.c.height - 1, self.c.width - 1)
             self.window.refresh()
         self.c.locked(lockedstuff)
@@ -373,7 +375,7 @@ class Blinkenlights(BlinkenBase, UIBase):
             sys.exit(0)
 
     def keypress(s, key):
-        if key > 255:
+        if key < 1 or key > 255:
             return
         
         if chr(key) == 'q':
@@ -476,7 +478,7 @@ class Blinkenlights(BlinkenBase, UIBase):
                 return s.af[accountname]
 
             # New one.
-            s.af[accountname] = CursesAccountFrame(s.c, accountname)
+            s.af[accountname] = CursesAccountFrame(s.c, accountname, s)
             s.c.lock()
             try:
                 s.c.reset()
@@ -509,6 +511,8 @@ class Blinkenlights(BlinkenBase, UIBase):
                 return
             if color:
                 s.gettf().setcolor(color)
+            elif s.gettf().getcolor() == 'black':
+                s.gettf().setcolor('gray')
             s._addline(msg, s.gettf().getcolorpair())
             s.logwindow.refresh()
         finally:
@@ -525,9 +529,9 @@ class Blinkenlights(BlinkenBase, UIBase):
         finally:
             s.c.unlock()
 
-    def terminate(s, exitstatus = 0):
+    def terminate(s, exitstatus = 0, errortitle = None, errormsg = None):
         s.c.stop()
-        UIBase.terminate(s, exitstatus)
+        UIBase.terminate(s, exitstatus = exitstatus, errortitle = errortitle, errormsg = errormsg)
 
     def threadException(s, thread):
         s.c.stop()