#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
from Blinkenlights import BlinkenBase
from UIBase import UIBase
from threading import *
-import thread, time, sys, os
+import thread, time, sys, os, signal, time
from offlineimap import version, threadutil
from offlineimap.threadutil import MultiLock
s.gettf().setcolor('red')
s._msg(version.banner)
s.inputhandler.set_bgchar(s.keypress)
+ signal.signal(signal.SIGWINCH, s.resizehandler)
+ s.resizelock = Lock()
+ s.resizecount = 0
+
+ def resizehandler(s, signum, frame):
+ s.resizeterm()
+
+ def resizeterm(s, dosleep = 1):
+ if not s.resizelock.acquire(0):
+ s.resizecount += 1
+ return
+ signal.signal(signal.SIGWINCH, signal.SIG_IGN)
+ s.aflock.acquire()
+ s.c.lock()
+ s.resizecount += 1
+ while s.resizecount:
+ s.c.reset()
+ s.setupwindows()
+ s.resizecount -= 1
+ s.c.unlock()
+ s.aflock.release()
+ s.resizelock.release()
+ signal.signal(signal.SIGWINCH, s.resizehandler)
+ if dosleep:
+ time.sleep(1)
+ s.resizeterm(0)
def isusable(s):
# Not a terminal? Can't use curses.