Don't copy 'id' from the option section into the implementation section.
The read_config procs should fetch arguments from both the option and implemention sections.
This commit is contained in:
@@ -384,10 +384,6 @@ class InstConfigData(object):
|
|||||||
enabled = config_desc['enabled'].__str__()
|
enabled = config_desc['enabled'].__str__()
|
||||||
self.file_parser.set(config, 'enabled', enabled)
|
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'
|
scratch_file = self.config_filename + '.scratch'
|
||||||
with open(scratch_file, 'w') as cfile:
|
with open(scratch_file, 'w') as cfile:
|
||||||
for config in sorted(self.config_dict.keys()):
|
for config in sorted(self.config_dict.keys()):
|
||||||
@@ -468,18 +464,22 @@ class InstConfigView(urwid.Frame):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def _msg_hdr(self, msg):
|
def _msg_hdr(self, msg):
|
||||||
|
"""Display a message after the help string"""
|
||||||
hdr = self.help_str + msg
|
hdr = self.help_str + msg
|
||||||
self.header_text.set_text(hdr)
|
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)
|
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._msg_hdr(msg)
|
||||||
self.main_loop.set_alarm_in(t_sec, self._msg_cb, '')
|
self.main_loop.set_alarm_in(t_sec, self._msg_cb, '')
|
||||||
|
|
||||||
def set_main(self, m):
|
def set_main(self, main_loop):
|
||||||
self.main_loop = m
|
"""Pass a reference to the main loop to InstConfigView"""
|
||||||
|
self.main_loop = main_loop
|
||||||
|
|
||||||
# Contains OptionListWalker dict indexed by option
|
# Contains OptionListWalker dict indexed by option
|
||||||
# Contains ImpListBox
|
# Contains ImpListBox
|
||||||
@@ -488,8 +488,7 @@ class InstConfigView(urwid.Frame):
|
|||||||
# and sets selection on ImpListBox
|
# and sets selection on ImpListBox
|
||||||
class InstConfigManager(object):
|
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):
|
def __init__(self, cf_dat):
|
||||||
self.cf_dat = cf_dat
|
self.cf_dat = cf_dat
|
||||||
@@ -656,7 +655,7 @@ def gen_input_handler(cf_man, cf_dat, cf_viewer):
|
|||||||
raise urwid.ExitMainLoop()
|
raise urwid.ExitMainLoop()
|
||||||
elif key == 'w':
|
elif key == 'w':
|
||||||
cf_dat.backup_files()
|
cf_dat.backup_files()
|
||||||
cf_viewer._timed_msg(1, ': Saving file')
|
cf_viewer.timed_msg(1, ': Saving file')
|
||||||
cf_dat.write_config_file()
|
cf_dat.write_config_file()
|
||||||
elif key in ['right', 'tab']:
|
elif key in ['right', 'tab']:
|
||||||
if cf_viewer.cfg_pile.get_focus() == cf_man.cfg_lb:
|
if cf_viewer.cfg_pile.get_focus() == cf_man.cfg_lb:
|
||||||
|
|||||||
Reference in New Issue
Block a user