/offlineimap/head: changeset 183
Adding configuration information for Blinkenlights.
This commit is contained in:
parent
11ca9ea196
commit
2a4b20e951
@ -54,7 +54,8 @@ maxsyncaccounts = 1
|
|||||||
# fails, the second, and so forth.
|
# fails, the second, and so forth.
|
||||||
#
|
#
|
||||||
# The pre-defined options are:
|
# The pre-defined options are:
|
||||||
# Tk.TkUI -- A graphical interface
|
# Tk.Blinkenlights -- A graphical interface, shows LEDs and a single log
|
||||||
|
# Tk.VerboseUI -- A graphical interface, shows logs per thread
|
||||||
# TTY.TTYUI -- a text-based (terminal) interface
|
# TTY.TTYUI -- a text-based (terminal) interface
|
||||||
# Noninteractive.Basic -- Noninteractive interface suitable for cronning
|
# Noninteractive.Basic -- Noninteractive interface suitable for cronning
|
||||||
# Noninteractive.Quiet -- Noninteractive interface, generates no output
|
# Noninteractive.Quiet -- Noninteractive interface, generates no output
|
||||||
@ -62,7 +63,7 @@ maxsyncaccounts = 1
|
|||||||
#
|
#
|
||||||
# You can override this with a command-line option -u.
|
# You can override this with a command-line option -u.
|
||||||
|
|
||||||
ui = Tk.TkUI, TTY.TTYUI
|
ui = Tk.Blinkenlights, Tk.VerboseUI, TTY.TTYUI, Noninteractive.Basic
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@ -87,6 +88,21 @@ peritem = "+%(accountname)s/%(foldername)s"
|
|||||||
sep = " "
|
sep = " "
|
||||||
footer = "\n"
|
footer = "\n"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Blinkenlights configuration
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
[ui.Tk.Blinkenlights]
|
||||||
|
|
||||||
|
# Specifies the default number of lines in the log.
|
||||||
|
|
||||||
|
loglines = 5
|
||||||
|
|
||||||
|
# If true, says that the log should be enabled by default.
|
||||||
|
# Otherwise, you have to click "Show Log" to enable the log.
|
||||||
|
|
||||||
|
showlog = false
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Accounts
|
# Accounts
|
||||||
##################################################
|
##################################################
|
||||||
|
@ -60,7 +60,7 @@ if not os.path.exists(configfilename):
|
|||||||
config.read(configfilename)
|
config.read(configfilename)
|
||||||
|
|
||||||
if '-u' in options:
|
if '-u' in options:
|
||||||
ui = offlineimap.ui.detector.getUImod(options['-u'])()
|
ui = offlineimap.ui.detector.getUImod(options['-u'])(config)
|
||||||
else:
|
else:
|
||||||
ui = offlineimap.ui.detector.findUI(config)
|
ui = offlineimap.ui.detector.findUI(config)
|
||||||
ui.init_banner()
|
ui.init_banner()
|
||||||
@ -94,6 +94,8 @@ else:
|
|||||||
# asking for passwords simultaneously.
|
# asking for passwords simultaneously.
|
||||||
|
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
|
if '.' in account:
|
||||||
|
raise ValueError, "Account '%s' contains a dot; dots are not allowed in account names."
|
||||||
if config.has_option(account, "preauthtunnel"):
|
if config.has_option(account, "preauthtunnel"):
|
||||||
tunnels[account] = config.get(account, "preauthtunnel")
|
tunnels[account] = config.get(account, "preauthtunnel")
|
||||||
elif config.has_option(account, "remotepass"):
|
elif config.has_option(account, "remotepass"):
|
||||||
|
@ -40,5 +40,5 @@ class Basic(UIBase):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
class Quiet(Basic):
|
class Quiet(Basic):
|
||||||
def __init__(s, verbose = -1):
|
def __init__(s, config, verbose = -1):
|
||||||
Basic.__init__(s, verbose)
|
Basic.__init__(s, config, verbose)
|
||||||
|
@ -358,14 +358,16 @@ class Blinkenlights(VerboseUI):
|
|||||||
self.canvas = c
|
self.canvas = c
|
||||||
c.pack(side = BOTTOM, expand = 1)
|
c.pack(side = BOTTOM, expand = 1)
|
||||||
widthmetric = tkFont.Font(family = 'Helvetica', size = 8).measure("0")
|
widthmetric = tkFont.Font(family = 'Helvetica', size = 8).measure("0")
|
||||||
|
self.loglines = 5
|
||||||
|
if s.config.has_option("ui.Tk.Blinkenlights", "loglines"):
|
||||||
|
self.loglines = s.config.getint("ui.Tk.Blinkenlights", "loglines")
|
||||||
self.text = Text(self.top, bg = 'black', font = ("Helvetica", 8),
|
self.text = Text(self.top, bg = 'black', font = ("Helvetica", 8),
|
||||||
bd = 0, highlightthickness = 0, setgrid = 0,
|
bd = 0, highlightthickness = 0, setgrid = 0,
|
||||||
state = DISABLED, height = 5, wrap = NONE,
|
state = DISABLED, height = self.loglines, wrap = NONE,
|
||||||
width = int(c.cget('width')) / widthmetric)
|
width = int(c.cget('width')) / widthmetric)
|
||||||
self.textenabled = 0
|
self.textenabled = 0
|
||||||
self.tags = []
|
self.tags = []
|
||||||
self.textlock = Lock()
|
self.textlock = Lock()
|
||||||
self.loglines = 5
|
|
||||||
|
|
||||||
def gettf(s, newtype=LEDThreadFrame):
|
def gettf(s, newtype=LEDThreadFrame):
|
||||||
return VerboseUI.gettf(s, newtype, s.canvas)
|
return VerboseUI.gettf(s, newtype, s.canvas)
|
||||||
@ -383,6 +385,9 @@ class Blinkenlights(VerboseUI):
|
|||||||
s.menubar = menubar
|
s.menubar = menubar
|
||||||
s.gettf().setcolor('red')
|
s.gettf().setcolor('red')
|
||||||
s._msg(version.banner)
|
s._msg(version.banner)
|
||||||
|
if s.config.has_option("ui.Tk.Blinkenlights", "showlog") and \
|
||||||
|
s.config.getboolean("ui.Tk.Blinkenlights", "showlog"):
|
||||||
|
s._togglelog()
|
||||||
|
|
||||||
def _largerlog(s):
|
def _largerlog(s):
|
||||||
s.loglines += 1
|
s.loglines += 1
|
||||||
|
@ -22,8 +22,9 @@ import re, time, sys, traceback
|
|||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
class UIBase:
|
class UIBase:
|
||||||
def __init__(s, verbose = 0):
|
def __init__(s, config, verbose = 0):
|
||||||
s.verbose = verbose
|
s.verbose = verbose
|
||||||
|
s.config = config
|
||||||
|
|
||||||
################################################## UTILS
|
################################################## UTILS
|
||||||
def _msg(s, msg):
|
def _msg(s, msg):
|
||||||
|
@ -27,7 +27,7 @@ def findUI(config):
|
|||||||
for uistr in uistrlist:
|
for uistr in uistrlist:
|
||||||
uimod = getUImod(uistr)
|
uimod = getUImod(uistr)
|
||||||
if uimod:
|
if uimod:
|
||||||
uiinstance = uimod()
|
uiinstance = uimod(config)
|
||||||
if uiinstance.isusable():
|
if uiinstance.isusable():
|
||||||
return uiinstance
|
return uiinstance
|
||||||
sys.stderr.write("ERROR: No UIs were found usable!\n")
|
sys.stderr.write("ERROR: No UIs were found usable!\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user