Rework UI system to make use of the logging module

Logging was flawed as the output was e.g. heavily buffered and people
complained about missing log entries. Fix this by making use of the
standard logging facilities that offlineimap offers.

This is one big ugly patch that does many things. It fixes the
Blinkenlights backend to work again with the logging facilities.

Resize windows and hotkeys are still not handled absolut correctly, this
is left for future fixing. THe rest of the backends should be working fine.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth
2011-10-26 16:47:21 +02:00
parent d4a11c62ea
commit cbec8bb5b2
12 changed files with 829 additions and 945 deletions

View File

@ -143,7 +143,7 @@ class Account(CustomConfig.ConfigHelperMixin):
for item in kaobjs:
item.startkeepalive()
refreshperiod = int(self.refreshperiod * 60)
sleepresult = self.ui.sleep(refreshperiod, self)
@ -166,7 +166,8 @@ class Account(CustomConfig.ConfigHelperMixin):
self.ui.serverdiagnostics(remote_repo, 'Remote')
self.ui.serverdiagnostics(local_repo, 'Local')
#self.ui.serverdiagnostics(statusrepos, 'Status')
class SyncableAccount(Account):
"""A syncable email account connecting 2 repositories
@ -208,7 +209,7 @@ class SyncableAccount(Account):
self.ui.registerthread(self.name)
accountmetadata = self.getaccountmeta()
if not os.path.exists(accountmetadata):
os.mkdir(accountmetadata, 0700)
os.mkdir(accountmetadata, 0700)
self.remoterepos = Repository(self, 'remote')
self.localrepos = Repository(self, 'local')
@ -223,7 +224,7 @@ class SyncableAccount(Account):
self.sync()
except (KeyboardInterrupt, SystemExit):
raise
except OfflineImapError, e:
except OfflineImapError, e:
# Stop looping and bubble up Exception if needed.
if e.severity >= OfflineImapError.ERROR.REPO:
if looping:
@ -242,7 +243,7 @@ class SyncableAccount(Account):
self.ui.acctdone(self)
self.unlock()
if looping and self.sleeper() >= 2:
looping = 0
looping = 0
def sync(self):
"""Synchronize the account once, then return
@ -408,7 +409,7 @@ def syncfolder(accountname, remoterepos, remotefolder, localrepos,
else:
ui.debug('imap', "Not syncing to read-only repository '%s'" \
% localrepos.getname())
# Synchronize local changes
if not remoterepos.getconfboolean('readonly', False):
ui.syncingmessages(localrepos, localfolder, remoterepos, remotefolder)