1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-02 20:04:16 +01:00
This commit is contained in:
Dan O'Reilly
2009-03-27 23:14:19 -04:00
3 changed files with 22 additions and 7 deletions

View File

@@ -316,6 +316,7 @@ class ComboBox(urwid.WidgetWrap):
user_args : user_args in the callback user_args : user_args in the callback
""" """
self.DOWN_ARROW = ' vvv'
self.label = urwid.Text(label) self.label = urwid.Text(label)
self.attrs = attrs self.attrs = attrs
self.focus_attr = focus_attr self.focus_attr = focus_attr
@@ -325,7 +326,7 @@ class ComboBox(urwid.WidgetWrap):
self.overlay = None self.overlay = None
#w,sensitive=True,attrs=('editbx','editnfc'),focus_attr='editfc') #w,sensitive=True,attrs=('editbx','editnfc'),focus_attr='editfc')
self.cbox = DynWrap(SelText(' vvv'),attrs=attrs,focus_attr=focus_attr) self.cbox = DynWrap(SelText(self.DOWN_ARROW),attrs=attrs,focus_attr=focus_attr)
# Unicode will kill me sooner or later. ^_^ # Unicode will kill me sooner or later. ^_^
if label != '': if label != '':
w = urwid.Columns([('fixed',len(str),self.label),self.cbox],dividechars=1) w = urwid.Columns([('fixed',len(str),self.label),self.cbox],dividechars=1)
@@ -351,7 +352,7 @@ class ComboBox(urwid.WidgetWrap):
def set_focus(self,index): def set_focus(self,index):
self.focus = index self.focus = index
self.cbox.set_w(SelText(self.list[index]+' vvv')) self.cbox.set_w(SelText(self.list[index]+self.DOWN_ARROW))
if self.overlay: if self.overlay:
self.overlay._listbox.set_focus(index) self.overlay._listbox.set_focus(index)
@@ -360,7 +361,7 @@ class ComboBox(urwid.WidgetWrap):
def build_combobox(self,parent,ui,row): def build_combobox(self,parent,ui,row):
str,trash = self.label.get_text() str,trash = self.label.get_text()
self.cbox = DynWrap(SelText([self.list[self.focus]+' vvv']), self.cbox = DynWrap(SelText([self.list[self.focus]+self.DOWN_ARROW]),
attrs=self.attrs,focus_attr=self.focus_attr) attrs=self.attrs,focus_attr=self.focus_attr)
if str != '': if str != '':
w = urwid.Columns([('fixed',len(str),self.label),self.cbox], w = urwid.Columns([('fixed',len(str),self.label),self.cbox],

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
"""prefs_curses.py -- Pretty, tabbable, console preferences dialog"""
# Copyright (C) 2008-2009 Andrew Psaltis # Copyright (C) 2008-2009 Andrew Psaltis
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@@ -556,6 +556,7 @@ class appGUI():
('R' ,'Refresh',None), ('R' ,'Refresh',None),
('P' ,'Prefs',None), ('P' ,'Prefs',None),
('I' ,'Hidden',None), ('I' ,'Hidden',None),
('A' ,'About',None),
('Q' ,'Quit',loop.quit) ('Q' ,'Quit',loop.quit)
] ]
@@ -581,6 +582,7 @@ class appGUI():
self.prev_state = False self.prev_state = False
self.connecting = False self.connecting = False
self.screen_locked = False self.screen_locked = False
self.do_diag_lock = False
self.pref = None self.pref = None
@@ -602,11 +604,17 @@ class appGUI():
# Does what it says it does # Does what it says it does
def lock_screen(self): def lock_screen(self):
if self.diag:
self.do_diag_lock = True
return True
self.frame.set_body(self.screen_locker) self.frame.set_body(self.screen_locker)
self.screen_locked = True self.screen_locked = True
self.update_ui() self.update_ui()
def unlock_screen(self): def unlock_screen(self):
if self.do_diag_lock:
self.do_diag_lock = False
return True
self.update_netlist(force_check=True) self.update_netlist(force_check=True)
self.frame.set_body(self.thePile) self.frame.set_body(self.thePile)
self.screen_locked = False self.screen_locked = False
@@ -810,7 +818,11 @@ class appGUI():
self.lock_screen() self.lock_screen()
def restore_primary(self): def restore_primary(self):
self.frame.set_body(self.thePile) if self.do_diag_lock:
self.frame.set_body(self.screen_locker)
self.do_diag_lock = False
else:
self.frame.set_body(self.thePile)
self.diag = None self.diag = None
self.frame.set_footer(urwid.Pile([self.primaryCols,self.footer2])) self.frame.set_footer(urwid.Pile([self.primaryCols,self.footer2]))
self.update_ui() self.update_ui()
@@ -916,7 +928,7 @@ class appGUI():
focus=True) focus=True)
continue continue
if self.diag: if self.diag:
if k == 'esc': if k == 'esc' or k == 'q' or k == 'Q':
self.restore_primary() self.restore_primary()
break break
if k == 'meta enter': if k == 'meta enter':
@@ -983,7 +995,7 @@ def main():
# Thanks to nanotube on #wicd for helping with this # Thanks to nanotube on #wicd for helping with this
ui.register_palette([ ui.register_palette([
('body','default','default'), ('body','default','default'),
('focus','dark magenta','light gray'), ('focus','black','light gray'),
('header','light blue','default'), ('header','light blue','default'),
('important','light red','default'), ('important','light red','default'),
('connected','dark green','default'), ('connected','dark green','default'),
@@ -995,7 +1007,7 @@ def main():
('tab active','dark green','light gray'), ('tab active','dark green','light gray'),
('infobar','light gray','dark blue'), ('infobar','light gray','dark blue'),
('timebar','dark gray','default'), ('timebar','dark gray','default'),
('listbar','dark gray','default'), ('listbar','light blue','default'),
# Simple colors around text # Simple colors around text
('green','dark green','default'), ('green','dark green','default'),
('blue','light blue','default'), ('blue','light blue','default'),