/head: changeset 107

More work with the UIs
This commit is contained in:
jgoerzen 2002-07-12 02:38:36 +01:00
parent acc436beb1
commit 1953d0f76f
2 changed files with 12 additions and 3 deletions

View File

@ -27,10 +27,10 @@ class TTYUI(UIBase):
self.iswaiting = 0 self.iswaiting = 0
def _msg(s, msg): def _msg(s, msg):
if currentThread().getName() == 'MainThread': if (currentThread().getName() == 'MainThread'):
print msg print msg
else: else:
print "%-30s %s" % (currentThread().getName(), msg) print "%s:\n %s" % (currentThread().getName(), msg)
sys.stdout.flush() sys.stdout.flush()
def getpass(s, accountname, config): def getpass(s, accountname, config):

View File

@ -35,6 +35,12 @@ class UIBase:
# Strip off extra stuff. # Strip off extra stuff.
return re.sub('(Folder|Repository)', '', prelimname) return re.sub('(Folder|Repository)', '', prelimname)
def isusable(s):
"""Returns true if this UI object is usable in the current
environment. For instance, an X GUI would return true if it's
being run in X with a valid DISPLAY setting, and false otherwise."""
return 1
################################################## INPUT ################################################## INPUT
def getpass(s, accountname, config): def getpass(s, accountname, config):
@ -46,7 +52,10 @@ class UIBase:
################################################## MESSAGES ################################################## MESSAGES
def init_banner(s): def init_banner(s):
"Display the copyright banner." """Called when the UI starts. Must be called before any other UI
call except isusable(). Displays the copyright banner. This is
where the UI should do its setup -- TK, for instance, would
create the application window here."""
s._msg(offlineimap.version.banner) s._msg(offlineimap.version.banner)
def acct(s, accountname): def acct(s, accountname):