OfflineImap has various ui systems, that can be selected. They offer various functionalities. They must implement all functions that the offlineimap.ui.UIBase offers. Early on, the ui must be set using getglobalui()
Set the global ui object to be used for logging
Return the current ui object
Output that we start syncing an account (and start counting)
linking active accounts with the time.time() when sync started
Output that we finished syncing an account (in which time)
Log ‘Establishing connection to’
Output a log line stating which message we copy
list of debugtypes we are supposed to log
debugmessages in a deque(v) per thread(k)
Log a message at severity level ERROR
Log Exception ‘exc’ to error log, possibly prepended by a preceding error “msg”, detailing at what point the error occurred.
In debug mode, we also output the full traceback that occurred if one has been passed in via sys.info()[2].
Also save the Exception to a stack that can be output at the end of the sync run when offlineiamp exits. It is recommended to always pass in exceptions if possible, so we can give the user the best debugging info.
One example of such a call might be:
- ui.error(exc, sys.exc_info()[2], msg=”While syncing Folder %s in “
- “repo %s”)
saves all occuring exceptions, so we can output them at the end
Return the type of a repository or Folder as string
(IMAP, Gmail, Maildir, etc...)
Get Account() for a thread (current if None)
If no account has been registered with this thread, return ‘None’
Display a message.
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.
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.
Called when a folder is created
Register current thread as being associated with an account name
Output a log line stating that we save a msg
Connect to repository and output useful information for debugging
Create file handler which logs to file
Backend specific console handler
Sets up things and adds them to self.logger. :returns: The logging.Handler() for console output
Called when a folder sync operation is started.
This function does not actually output anything, but handles the overall sleep, dealing with updates as necessary. It will, however, call sleeping() which DOES output something.
Returns: | 0/False if timeout expired, 1/2/True if there is a request to cancel the timer. |
---|
Sleep for sleepsecs, display remainingsecs to go.
Does nothing if sleepsecs <= 0. Display a message on the screen if we pass a full minute.
This implementation in UIBase does not support this, but some implementations return 0 for successful sleep and 1 for an ‘abort’, ie a request to sync immediately.
Log ‘Copying folder structure...’
Called when a folder sync operation is started.
Called to terminate the application.
Called when a thread has terminated with an exception. The argument is the ExitNotifyThread that has so terminated.
Called when a thread has exited normally. Many UIs will just ignore this.
dict linking active threads (k) to account names (v)
Unregister a thread as being associated with an account name