Implement group headings in the listbox
This commit is contained in:
@@ -91,7 +91,8 @@ def main(config_filename):
|
||||
lb_list = []
|
||||
cb_list = []
|
||||
for key in sorted(cb_map.keys()):
|
||||
lb_list.append(urwid.AttrWrap(urwid.Text("Group: %s" % key), 'bright'))
|
||||
if len(key) > 0:
|
||||
lb_list.append(urwid.AttrWrap(urwid.Text("Group: %s" % key), 'bright'))
|
||||
for txt in sorted(cb_map[key]):
|
||||
state = False
|
||||
if 'enabled' in config.options(txt):
|
||||
@@ -129,16 +130,9 @@ def main(config_filename):
|
||||
blank
|
||||
]
|
||||
|
||||
if False:
|
||||
listbox = urwid.Pile(cb_list)
|
||||
else:
|
||||
if "SimpleFocusListWalker" in dir(urwid):
|
||||
sflw = urwid.SimpleFocusListWalker(listbox_content)
|
||||
sflw.set_focus_changed_callback(fcc)
|
||||
else:
|
||||
sflw = urwid.SimpleListWalker(listbox_content)
|
||||
|
||||
header = urwid.AttrWrap(urwid.Text(text_header), 'header')
|
||||
sflw = urwid.SimpleListWalker(lb_list)
|
||||
listbox = urwid.ListBox(sflw)
|
||||
frame = urwid.Frame(urwid.AttrWrap(listbox, 'body'), header=header)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user