Merge branch 'ss/deprecate-current-ui-names' into next

This commit is contained in:
Nicolas Sebrecht 2011-03-06 18:33:29 +01:00
commit 976c071dd7
5 changed files with 50 additions and 45 deletions

View File

@ -23,6 +23,9 @@ Changes
* Makefile use magic to find the version number.
* Rework the repository module
* Change UI names to Blinkenlights,TTYUI,Basic,Quiet,MachineUI.
Old names will still work, but are deprecated.
Document that we don't accept a list of UIs anymore.
Bug Fixes
---------

View File

@ -134,30 +134,29 @@ OPTIONS
Specifies an alternative user interface module to use. This overrides the
default specified in the configuration file. The pre-defined options are
listed in the User Interfaces section.
listed in the User Interfaces section. The interface name is case insensitive.
User Interfaces
===============
OfflineIMAP has a pluggable user interface system that lets you choose how the
program communicates information to you. There are two graphical interfaces,
two terminal interfaces, and two noninteractive interfaces suitable for
scripting or logging purposes. The ui option in the configuration file
specifies user interface preferences. The -u command-line option can override
the configuration file setting. The available values for the configuration file
or command-line are described in this section.
OfflineIMAP has various user interfaces that let you choose how the
program communicates information to you. The 'ui' option in the
configuration file specifies the user interface. The -u command-line
option overrides the configuration file setting. The available values
for the configuration file or command-line are described in this
section.
Curses.Blinkenlights
--------------------
Blinkenlights
---------------
Curses.Blinkenlights is an interface designed to be sleek, fun to watch, and
Blinkenlights is an interface designed to be sleek, fun to watch, and
informative of the overall picture of what OfflineIMAP is doing. I consider it
to be the best general-purpose interface in OfflineIMAP.
Curses.Blinkenlights contains a row of "LEDs" with command buttons and a log.
Blinkenlights contains a row of "LEDs" with command buttons and a log.
The log shows more detail about what is happening and is color-coded to match
the color of the lights.
@ -228,18 +227,18 @@ English-speaking world. One version ran in its entirety as follows:
| pockets muss; relaxen und watchen das blinkenlichten.
TTY.TTYUI
TTYUI
---------
TTY.TTYUI interface is for people running in basic, non-color terminals. It
TTYUI interface is for people running in basic, non-color terminals. It
prints out basic status messages and is generally friendly to use on a console
or xterm.
Noninteractive.Basic
Basic
--------------------
Noninteractive.Basic is designed for situations in which OfflineIMAP will be run
Basic is designed for situations in which OfflineIMAP will be run
non-attended and the status of its execution will be logged. You might use it,
for instance, to have the system run automatically and e-mail you the results of
the synchronization. This user interface is not capable of reading a password
@ -247,20 +246,19 @@ from the keyboard; account passwords must be specified using one of the
configuration file options.
Noninteractive.Quiet
--------------------
Quiet
-----
Noninteractive.Quiet is designed for non-attended running in situations where
normal status messages are not desired. It will output nothing except errors
and serious warnings. Like Noninteractive.Basic, this user interface is not
capable of reading a password from the keyboard; account passwords must be
specified using one of the configuration file options.
Quiet is designed for non-attended running in situations where normal
status messages are not desired. It will output nothing except errors
and serious warnings. Like Noninteractive.Basic, this user interface is
not capable of reading a password from the keyboard; account passwords
must be specified using one of the configuration file options.
MachineUI
---------
Machine.MachineUI
-----------------
Machine.MachineUI generates output in a machine-parsable format. It is designed
MachineUI generates output in a machine-parsable format. It is designed
for other programs that will interface to OfflineIMAP.

View File

@ -55,19 +55,17 @@ maxsyncaccounts = 1
# fails, the second, and so forth.
#
# The pre-defined options are:
# Curses.Blinkenlights -- A text-based (terminal) interface similar to
# Tk.Blinkenlights
# TTY.TTYUI -- a text-based (terminal) interface
# Noninteractive.Basic -- Noninteractive interface suitable for cronning
# Noninteractive.Quiet -- Noninteractive interface, generates no output
# except for errors.
# Machine.MachineUI -- Interactive interface suitable for machine
# parsing.
# Blinkenlights -- A fancy (terminal) interface
# TTYUI -- a text-based (terminal) interface
# Basic -- Noninteractive interface suitable for cron'ing
# Quiet -- Noninteractive interface, generates no output
# except for errors.
# MachineUI -- Interactive interface suitable for machine
# parsing.
#
# You can override this with a command-line option -u.
ui = Curses.Blinkenlights, TTY.TTYUI,
Noninteractive.Basic, Noninteractive.Quiet
ui = Blinkenlights
# If you try to synchronize messages to a read-only folder,
# OfflineIMAP will generate a warning. If you want to suppress these

View File

@ -187,12 +187,18 @@ class OfflineImap:
section = "general"
config.set(section, key, value)
#init the ui, cmd line option overrides config file
ui_type = config.getdefault('general','ui', 'TTY.TTYUI')
#which ui to use? cmd line option overrides config file
ui_type = config.getdefault('general','ui', 'ttyui')
if options.interface != None:
ui_type = options.interface
if '.' in ui_type:
#transform Curses.Blinkenlights -> Blinkenlights
ui_type = ui_type.split('.')[-1]
logging.warning('Using old interface name, consider using one '
'of %s' % ', '.join(UI_LIST.keys()))
try:
ui = UI_LIST[ui_type](config)
# create the ui class
ui = UI_LIST[ui_type.lower()](config)
except KeyError:
logging.error("UI '%s' does not exist, choose one of: %s" % \
(ui_type,', '.join(UI_LIST.keys())))

View File

@ -18,14 +18,14 @@
from offlineimap.ui.UIBase import getglobalui, setglobalui
from offlineimap.ui import TTY, Noninteractive, Machine
UI_LIST = {'TTY.TTYUI': TTY.TTYUI,
'Noninteractive.Basic': Noninteractive.Basic,
'Noninteractive.Quiet': Noninteractive.Quiet,
'Machine.MachineUI': Machine.MachineUI}
UI_LIST = {'ttyui': TTY.TTYUI,
'basic': Noninteractive.Basic,
'quiet': Noninteractive.Quiet,
'machineui': Machine.MachineUI}
#add Blinkenlights UI if it imports correctly (curses installed)
try:
from offlineimap.ui import Curses
UI_LIST['Curses.Blinkenlights'] = Curses.Blinkenlights
UI_LIST['blinkenlights'] = Curses.Blinkenlights
except ImportError:
pass