diff --git a/site_ansto/instrument/util/config_edit.py b/site_ansto/instrument/util/config_edit.py index 18738412..da6b6bfa 100755 --- a/site_ansto/instrument/util/config_edit.py +++ b/site_ansto/instrument/util/config_edit.py @@ -384,10 +384,6 @@ class InstConfigData(object): enabled = config_desc['enabled'].__str__() self.file_parser.set(config, 'enabled', enabled) - for imp, opt in self.imp2opt_dict.iteritems(): - if imp != 'none' and opt != 'none' and 'id' in self.opt_dict[opt]: - self.file_parser.set(imp, 'id', self.opt_dict[opt]['id']) - scratch_file = self.config_filename + '.scratch' with open(scratch_file, 'w') as cfile: for config in sorted(self.config_dict.keys()): @@ -468,18 +464,22 @@ class InstConfigView(urwid.Frame): return def _msg_hdr(self, msg): + """Display a message after the help string""" hdr = self.help_str + msg self.header_text.set_text(hdr) - def _msg_cb(self, ml, msg): + def _msg_cb(self, main_loop, msg): + """Wrap the message function in an urwid main loop callback""" self._msg_hdr(msg) - def _timed_msg(self, t_sec, msg): + def timed_msg(self, t_sec, msg): + """Display a transient message for the given time""" self._msg_hdr(msg) self.main_loop.set_alarm_in(t_sec, self._msg_cb, '') - def set_main(self, m): - self.main_loop = m + def set_main(self, main_loop): + """Pass a reference to the main loop to InstConfigView""" + self.main_loop = main_loop # Contains OptionListWalker dict indexed by option # Contains ImpListBox @@ -488,8 +488,7 @@ class InstConfigView(urwid.Frame): # and sets selection on ImpListBox class InstConfigManager(object): - """Provides controller which keeps data and viewer in sync. - """ + """Provides controller which keeps data and viewer in sync.""" def __init__(self, cf_dat): self.cf_dat = cf_dat @@ -656,7 +655,7 @@ def gen_input_handler(cf_man, cf_dat, cf_viewer): raise urwid.ExitMainLoop() elif key == 'w': cf_dat.backup_files() - cf_viewer._timed_msg(1, ': Saving file') + cf_viewer.timed_msg(1, ': Saving file') cf_dat.write_config_file() elif key in ['right', 'tab']: if cf_viewer.cfg_pile.get_focus() == cf_man.cfg_lb: