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.
|
* Makefile use magic to find the version number.
|
||||||
* Rework the repository module
|
* 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
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
@ -134,30 +134,29 @@ OPTIONS
|
|||||||
|
|
||||||
Specifies an alternative user interface module to use. This overrides the
|
Specifies an alternative user interface module to use. This overrides the
|
||||||
default specified in the configuration file. The pre-defined options are
|
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
|
User Interfaces
|
||||||
===============
|
===============
|
||||||
|
|
||||||
OfflineIMAP has a pluggable user interface system that lets you choose how the
|
OfflineIMAP has various user interfaces that let you choose how the
|
||||||
program communicates information to you. There are two graphical interfaces,
|
program communicates information to you. The 'ui' option in the
|
||||||
two terminal interfaces, and two noninteractive interfaces suitable for
|
configuration file specifies the user interface. The -u command-line
|
||||||
scripting or logging purposes. The ui option in the configuration file
|
option overrides the configuration file setting. The available values
|
||||||
specifies user interface preferences. The -u command-line option can override
|
for the configuration file or command-line are described in this
|
||||||
the configuration file setting. The available values for the configuration file
|
section.
|
||||||
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
|
informative of the overall picture of what OfflineIMAP is doing. I consider it
|
||||||
to be the best general-purpose interface in OfflineIMAP.
|
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 log shows more detail about what is happening and is color-coded to match
|
||||||
the color of the lights.
|
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.
|
| 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
|
prints out basic status messages and is generally friendly to use on a console
|
||||||
or xterm.
|
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,
|
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
|
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
|
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.
|
configuration file options.
|
||||||
|
|
||||||
|
|
||||||
Noninteractive.Quiet
|
Quiet
|
||||||
--------------------
|
-----
|
||||||
|
|
||||||
Noninteractive.Quiet is designed for non-attended running in situations where
|
Quiet is designed for non-attended running in situations where normal
|
||||||
normal status messages are not desired. It will output nothing except errors
|
status messages are not desired. It will output nothing except errors
|
||||||
and serious warnings. Like Noninteractive.Basic, this user interface is not
|
and serious warnings. Like Noninteractive.Basic, this user interface is
|
||||||
capable of reading a password from the keyboard; account passwords must be
|
not capable of reading a password from the keyboard; account passwords
|
||||||
specified using one of the configuration file options.
|
must be specified using one of the configuration file options.
|
||||||
|
|
||||||
|
MachineUI
|
||||||
|
---------
|
||||||
|
|
||||||
Machine.MachineUI
|
MachineUI generates output in a machine-parsable format. It is designed
|
||||||
-----------------
|
|
||||||
|
|
||||||
Machine.MachineUI generates output in a machine-parsable format. It is designed
|
|
||||||
for other programs that will interface to OfflineIMAP.
|
for other programs that will interface to OfflineIMAP.
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,19 +55,17 @@ maxsyncaccounts = 1
|
|||||||
# fails, the second, and so forth.
|
# fails, the second, and so forth.
|
||||||
#
|
#
|
||||||
# The pre-defined options are:
|
# The pre-defined options are:
|
||||||
# Curses.Blinkenlights -- A text-based (terminal) interface similar to
|
# Blinkenlights -- A fancy (terminal) interface
|
||||||
# Tk.Blinkenlights
|
# TTYUI -- a text-based (terminal) interface
|
||||||
# TTY.TTYUI -- a text-based (terminal) interface
|
# Basic -- Noninteractive interface suitable for cron'ing
|
||||||
# Noninteractive.Basic -- Noninteractive interface suitable for cronning
|
# Quiet -- Noninteractive interface, generates no output
|
||||||
# Noninteractive.Quiet -- Noninteractive interface, generates no output
|
# except for errors.
|
||||||
# except for errors.
|
# MachineUI -- Interactive interface suitable for machine
|
||||||
# Machine.MachineUI -- Interactive interface suitable for machine
|
# parsing.
|
||||||
# parsing.
|
|
||||||
#
|
#
|
||||||
# You can override this with a command-line option -u.
|
# You can override this with a command-line option -u.
|
||||||
|
|
||||||
ui = Curses.Blinkenlights, TTY.TTYUI,
|
ui = Blinkenlights
|
||||||
Noninteractive.Basic, Noninteractive.Quiet
|
|
||||||
|
|
||||||
# If you try to synchronize messages to a read-only folder,
|
# If you try to synchronize messages to a read-only folder,
|
||||||
# OfflineIMAP will generate a warning. If you want to suppress these
|
# OfflineIMAP will generate a warning. If you want to suppress these
|
||||||
|
@ -187,12 +187,18 @@ class OfflineImap:
|
|||||||
section = "general"
|
section = "general"
|
||||||
config.set(section, key, value)
|
config.set(section, key, value)
|
||||||
|
|
||||||
#init the ui, cmd line option overrides config file
|
#which ui to use? cmd line option overrides config file
|
||||||
ui_type = config.getdefault('general','ui', 'TTY.TTYUI')
|
ui_type = config.getdefault('general','ui', 'ttyui')
|
||||||
if options.interface != None:
|
if options.interface != None:
|
||||||
ui_type = options.interface
|
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:
|
try:
|
||||||
ui = UI_LIST[ui_type](config)
|
# create the ui class
|
||||||
|
ui = UI_LIST[ui_type.lower()](config)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logging.error("UI '%s' does not exist, choose one of: %s" % \
|
logging.error("UI '%s' does not exist, choose one of: %s" % \
|
||||||
(ui_type,', '.join(UI_LIST.keys())))
|
(ui_type,', '.join(UI_LIST.keys())))
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
from offlineimap.ui.UIBase import getglobalui, setglobalui
|
from offlineimap.ui.UIBase import getglobalui, setglobalui
|
||||||
from offlineimap.ui import TTY, Noninteractive, Machine
|
from offlineimap.ui import TTY, Noninteractive, Machine
|
||||||
|
|
||||||
UI_LIST = {'TTY.TTYUI': TTY.TTYUI,
|
UI_LIST = {'ttyui': TTY.TTYUI,
|
||||||
'Noninteractive.Basic': Noninteractive.Basic,
|
'basic': Noninteractive.Basic,
|
||||||
'Noninteractive.Quiet': Noninteractive.Quiet,
|
'quiet': Noninteractive.Quiet,
|
||||||
'Machine.MachineUI': Machine.MachineUI}
|
'machineui': Machine.MachineUI}
|
||||||
|
|
||||||
#add Blinkenlights UI if it imports correctly (curses installed)
|
#add Blinkenlights UI if it imports correctly (curses installed)
|
||||||
try:
|
try:
|
||||||
from offlineimap.ui import Curses
|
from offlineimap.ui import Curses
|
||||||
UI_LIST['Curses.Blinkenlights'] = Curses.Blinkenlights
|
UI_LIST['blinkenlights'] = Curses.Blinkenlights
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user