]> code.delx.au - offlineimap/commitdiff
/head: changeset 107
authorjgoerzen <jgoerzen>
Fri, 12 Jul 2002 01:38:36 +0000 (02:38 +0100)
committerjgoerzen <jgoerzen>
Fri, 12 Jul 2002 01:38:36 +0000 (02:38 +0100)
More work with the UIs

head/offlineimap/ui/TTY.py
head/offlineimap/ui/UIBase.py

index 8d86bd7f8b93408792241ea4441b66f44d08d43b..c27f40f2f739a5a84b83aa0fd70b6f38364e7e25 100644 (file)
@@ -27,10 +27,10 @@ class TTYUI(UIBase):
         self.iswaiting = 0
         
     def _msg(s, msg):
-        if currentThread().getName() == 'MainThread':
+        if (currentThread().getName() == 'MainThread'):
             print msg
         else:
-            print "%-30s %s" % (currentThread().getName(), msg)
+            print "%s:\n   %s" % (currentThread().getName(), msg)
         sys.stdout.flush()
 
     def getpass(s, accountname, config):
index ff775a9b0696df243169f0b4e0b0a140a93a02cb..3a80ae478d6cb24ff55bbb52555293c29236dbb7 100644 (file)
@@ -35,6 +35,12 @@ class UIBase:
         # Strip off extra stuff.
         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
 
     def getpass(s, accountname, config):
@@ -46,7 +52,10 @@ class UIBase:
     ################################################## MESSAGES
 
     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)
 
     def acct(s, accountname):