1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-26 16:32:34 +01:00

curses/curses_misc.py:

added support for Meta and Ctrl being applied to keys in OptCols
curses/wicd-curses.py
  Changed the colors slightly, colorized the clock.
This commit is contained in:
Andrew Psaltis
2009-03-04 00:56:17 -05:00
parent a290b12e68
commit 0dfe5432bd
2 changed files with 25 additions and 14 deletions

View File

@@ -545,12 +545,21 @@ class OptCols(urwid.WidgetWrap):
# callbacks map the text contents to its assigned callback.
self.callbacks = []
for cmd in tuples:
if cmd[0] == 'left':
key = '<-'
elif cmd[0] == 'right':
key = '->'
else:
key = cmd[0]
splitcmd = cmd[0].split()
key = ''
for part in splitcmd:
if part == 'ctrl':
key+='C^'
elif part == 'meta':
key+='M^'
else:
if part == 'left':
key += '<-'
elif part == 'right':
key += '->'
else:
key += part
#theText = urwid.Text([(attrs[0],cmd[0]),(attrs[1],cmd[1])])
if debug:
callback = self.debugClick

View File

@@ -543,7 +543,9 @@ class appGUI():
#(' ' ,' ',None),
self.footer1 = OptCols(keys,debug=True)
self.time_label = urwid.Text(strftime('%H:%M:%S'))
#self.time_label = urwid.Text(strftime('%H:%M:%S'))
self.time_label = \
urwid.AttrWrap(urwid.Text(strftime('%H:%M:%S')), 'timebar')
self.status_label = urwid.AttrWrap(urwid.Text('blah'),'important')
self.footer2 = urwid.Columns([self.status_label,('fixed', 8, self.time_label)])
self.footerList = urwid.ListBox([self.footer1,self.footer2])
@@ -892,29 +894,29 @@ def main():
# Default Color scheme.
# Other potential color schemes can be found at:
# http://excess.org/urwid/wiki/RecommendedPalette
# Note: the current palette below is optimized for the linux console.
# For example, this looks particularly bad on a default-colored XTerm.
# NB: To find current terminal background use variable COLORFGBG
# Thanks to nanotube on #wicd for helping with this
ui.register_palette([
('body','default','default'),
('focus','dark magenta','light gray'),
('header','light blue','default'),
('important','light red','default'),
('connected','dark green','default'),
('connected focus','default','dark green'),
('connected focus','black','dark green'),
('editcp', 'default', 'default', 'standout'),
('editbx', 'light gray', 'dark blue'),
('editfc', 'white','dark blue', 'bold'),
('editnfc','dark gray','default'),
('editnfc','dark gray','default','bold'),
('tab active','dark green','light gray'),
('infobar','light gray','dark blue'),
('timebar','dark gray','default'),
# Simple colors around text
('green','dark green','default'),
('blue','dark blue','default'),
('red','dark red','default'),
('bold','white','black','bold')])
# This is a wrapper around a function that calls another a function that is a
# wrapper around a infinite loop. Fun.
# This is a wrapper around a function that calls another a function that
# is a wrapper around a infinite loop. Fun.
urwid.set_encoding('utf8')
ui.run_wrapper(run)