From f2c5f515c46a8d163f91c3da7c2349057a4c9a7c Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 28 Mar 2014 10:57:13 +1100 Subject: [PATCH] Add radio buttons to ini files (radio = radio_group_name) --- site_ansto/instrument/util/config_edit.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/site_ansto/instrument/util/config_edit.py b/site_ansto/instrument/util/config_edit.py index e622735f..a7ecae23 100755 --- a/site_ansto/instrument/util/config_edit.py +++ b/site_ansto/instrument/util/config_edit.py @@ -11,6 +11,7 @@ config = None verbose = False depth_list = [] line_list = [] +Radio_Groups = {} def read_config_file(config_filename): import ConfigParser @@ -134,10 +135,21 @@ def main(config_filename): if 'desc' in config.options(txt): cb_text += config.get(txt, 'desc').strip("\"") cb_text += ")" - cb = urwid.AttrWrap(urwid.CheckBox(cb_text, - state=state, - on_state_change=checkbox_change, - user_data=txt), 'buttn', 'buttnf') + if 'radio' in config.options(txt): + radio = config.get(txt, 'radio').strip("\"") + if radio not in Radio_Groups: + 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) lb_list.append(cb)