/offlineimap/head: changeset 183

Adding configuration information for Blinkenlights.
This commit is contained in:
jgoerzen
2002-07-24 23:20:42 +01:00
parent 11ca9ea196
commit 2a4b20e951
6 changed files with 33 additions and 9 deletions

View File

@ -40,5 +40,5 @@ class Basic(UIBase):
return 0
class Quiet(Basic):
def __init__(s, verbose = -1):
Basic.__init__(s, verbose)
def __init__(s, config, verbose = -1):
Basic.__init__(s, config, verbose)

View File

@ -358,14 +358,16 @@ class Blinkenlights(VerboseUI):
self.canvas = c
c.pack(side = BOTTOM, expand = 1)
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),
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)
self.textenabled = 0
self.tags = []
self.textlock = Lock()
self.loglines = 5
def gettf(s, newtype=LEDThreadFrame):
return VerboseUI.gettf(s, newtype, s.canvas)
@ -383,6 +385,9 @@ class Blinkenlights(VerboseUI):
s.menubar = menubar
s.gettf().setcolor('red')
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):
s.loglines += 1

View File

@ -22,8 +22,9 @@ import re, time, sys, traceback
from StringIO import StringIO
class UIBase:
def __init__(s, verbose = 0):
def __init__(s, config, verbose = 0):
s.verbose = verbose
s.config = config
################################################## UTILS
def _msg(s, msg):

View File

@ -27,7 +27,7 @@ def findUI(config):
for uistr in uistrlist:
uimod = getUImod(uistr)
if uimod:
uiinstance = uimod()
uiinstance = uimod(config)
if uiinstance.isusable():
return uiinstance
sys.stderr.write("ERROR: No UIs were found usable!\n")