Allow to use nicer UI names
The previous ui names were pretty unwieldy. Is it TTYUI.TTY or TTY.TTYUI? Do I have to use capitals and where? Simplify the names by making them case insensitive and by dropping everything before the dot. So "Curses.Blinkenlights" can now be invoked as "blinkenlights" or "BLINKENLIGHTS". The old names will still work just fine so the transition should be smooth. We issue a warning that the long names are deprecated. Document in offlineimap.conf that we don't accept lists of fallback UIs, but only one UI option (this was already the case before this commit but still wrongly documented). The list of accepted ui names is: ttyui (default), basic, quiet, machineui, blinkenlights Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
3b8e1f91cd
commit
4e28c7c93f
@ -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
|
||||
---------
|
||||
|
@ -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.
|
||||
|
||||
|
||||
|
@ -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
|
||||
# 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.
|
||||
# Machine.MachineUI -- Interactive interface suitable for machine
|
||||
# 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
|
||||
|
@ -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())))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user