/offlineimap/head: changeset 156

Moved verbosity checking into UIBase
This commit is contained in:
jgoerzen 2002-07-22 06:38:06 +01:00
parent 0361dd4783
commit c9b4de85b2
3 changed files with 17 additions and 39 deletions

View File

@ -22,9 +22,9 @@ import select, sys
from threading import *
class TTYUI(UIBase):
def __init__(self, verbose = 0):
self.verbose = 0
self.iswaiting = 0
def __init__(s, verbose = 0):
s.verbose = 0
s.iswaiting = 0
def _msg(s, msg):
if (currentThread().getName() == 'MainThread'):
@ -38,18 +38,6 @@ class TTYUI(UIBase):
(accountname, config.get(accountname, "remoteuser"),
config.get(accountname, "remotehost")))
def syncingmessages(s, sr, sf, dr, df):
if s.verbose:
UIBase.syncingmessages(s, sr, sf, dr, df)
def loadmessagelist(s, repos, folder):
if s.verbose:
UIBase.syncingmessages(s, repos, folder)
def messagelistloaded(s, repos, folder, count):
if s.verbose:
UIBase.messagelistloaded(s, repos, folder, count)
def sleep(s, sleepsecs):
s.iswaiting = 1
try:

View File

@ -140,9 +140,6 @@ class ThreadFrame(Frame):
class TkUI(UIBase):
def __init__(self, verbose = 0):
self.verbose = verbose
def isusable(s):
try:
Tk().destroy()
@ -282,17 +279,4 @@ class TkUI(UIBase):
time.sleep(sleepsecs)
return s.sleeping_abort
################################################## Copied from TTY
def syncingmessages(s, sr, sf, dr, df):
if s.verbose:
UIBase.syncingmessages(s, sr, sf, dr, df)
def loadmessagelist(s, repos, folder):
if s.verbose:
UIBase.syncingmessages(s, repos, folder)
def messagelistloaded(s, repos, folder, count):
if s.verbose:
UIBase.messagelistloaded(s, repos, folder, count)

View File

@ -22,6 +22,9 @@ import re, time, sys, traceback
from StringIO import StringIO
class UIBase:
def __init__(s, verbose = 0):
s.verbose = verbose]
################################################## UTILS
def _msg(s, msg):
"""Generic tool called when no other works."""
@ -77,20 +80,23 @@ class UIBase:
folder.getname())
def loadmessagelist(s, repos, folder):
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
folder.getname()))
if s.verbose:
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
folder.getname()))
def messagelistloaded(s, repos, folder, count):
s._msg("Message list for %s[%s] loaded: %d messages" % \
(s.getnicename(repos), folder.getname(), count))
if s.verbose:
s._msg("Message list for %s[%s] loaded: %d messages" % \
(s.getnicename(repos), folder.getname(), count))
############################## Message syncing
def syncingmessages(s, sr, sf, dr, df):
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
sf.getname(),
s.getnicename(dr),
df.getname()))
if s.verbose:
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
sf.getname(),
s.getnicename(dr),
df.getname()))
def copyingmessage(s, uid, src, destlist):
ds = s.folderlist(destlist)