Add radio buttons to ini files (radio = radio_group_name)

This commit is contained in:
Douglas Clowes
2014-03-28 10:57:13 +11:00
parent 9e6d04c693
commit f2c5f515c4

View File

@ -11,6 +11,7 @@ config = None
verbose = False verbose = False
depth_list = [] depth_list = []
line_list = [] line_list = []
Radio_Groups = {}
def read_config_file(config_filename): def read_config_file(config_filename):
import ConfigParser import ConfigParser
@ -134,10 +135,21 @@ def main(config_filename):
if 'desc' in config.options(txt): if 'desc' in config.options(txt):
cb_text += config.get(txt, 'desc').strip("\"") cb_text += config.get(txt, 'desc').strip("\"")
cb_text += ")" cb_text += ")"
cb = urwid.AttrWrap(urwid.CheckBox(cb_text, if 'radio' in config.options(txt):
state=state, radio = config.get(txt, 'radio').strip("\"")
on_state_change=checkbox_change, if radio not in Radio_Groups:
user_data=txt), 'buttn', 'buttnf') Radio_Groups[radio] = []
cb = urwid.AttrWrap(urwid.RadioButton(
Radio_Groups[radio],
cb_text,
state=state,
on_state_change=checkbox_change,
user_data=txt), 'buttn', 'buttnf')
else:
cb = urwid.AttrWrap(urwid.CheckBox(cb_text,
state=state,
on_state_change=checkbox_change,
user_data=txt), 'buttn', 'buttnf')
cb_list.append(cb) cb_list.append(cb)
lb_list.append(cb) lb_list.append(cb)