copy.copy() doesn't work with urwid on the SL6 VMs.
Explicitly make a new listwalker imp_lw to avoid overwriting the first entry in self.imp_lw_dict[opt] Python 2.6 requires field numbers for format strings.
This commit is contained in:
@ -143,12 +143,12 @@ class InstConfigData:
|
||||
|
||||
def opt_statechange(self, checkbox, new_state, udat=None):
|
||||
opt = checkbox.get_label()
|
||||
dbg.msg(3, 'InstConfigData:opt_statechange({},{},{})'.format(opt, new_state, udat))
|
||||
dbg.msg(3, 'InstConfigData:opt_statechange({0},{1},{2})'.format(opt, new_state, udat))
|
||||
self.opt_dict[opt]['enabled'] = new_state
|
||||
|
||||
def imp_statechange(self, button, new_state, opt):
|
||||
selected_imp = button.get_label()
|
||||
dbg.msg(self.msg_index, 'InstConfigData:imp_statechange({},{},{})'.format(selected_imp, new_state, opt))
|
||||
dbg.msg(self.msg_index, 'InstConfigData:imp_statechange({0},{1},{2})'.format(selected_imp, new_state, opt))
|
||||
self.msg_index = (self.msg_index - 3) % 2 + 4
|
||||
if new_state == True:
|
||||
self.opt_dict[opt]['selected_imp'] = selected_imp
|
||||
@ -204,7 +204,7 @@ class OptionListWalker(CheckBoxListWalker):
|
||||
return
|
||||
|
||||
def set_focus(self, pos):
|
||||
dbg.msg(0, 'OptionListWalker:set_focus({}) -> emit focus_change'.format(pos))
|
||||
dbg.msg(0, 'OptionListWalker:set_focus({0}) -> emit focus_change'.format(pos))
|
||||
urwid.emit_signal(self, 'focus_change', pos)
|
||||
return super(OptionListWalker, self).set_focus(pos)
|
||||
|
||||
@ -254,9 +254,17 @@ class InstConfigManager:
|
||||
self.imp_lw_dict[opt] = RadioButtonListWalker(imp_items, on_state_change=self.imp_statechange, user_data=opt)
|
||||
|
||||
self.options.sort()
|
||||
# ffr Make a sacrificail listwalker imp_lw because copy.copy()
|
||||
# doesn't work for urwid on the SL6 VMs
|
||||
firstopt = self.options[0][0]
|
||||
for opt,dict in cfdat.opt_dict.iteritems():
|
||||
self.options.append((opt, dict['imptype']))
|
||||
imp_items = []
|
||||
|
||||
imp_items.sort()
|
||||
imp_lw = RadioButtonListWalker(imp_items, on_state_change=self.imp_statechange, user_data=firstopt)
|
||||
self.option_lw = OptionListWalker(cfdat.opt_dict, self.opt_statechange)
|
||||
opt = self.options[0][0]
|
||||
self.imp_lb = ImpListBox(copy.copy(self.imp_lw_dict[opt]))
|
||||
self.imp_lb = ImpListBox(imp_lw)
|
||||
urwid.connect_signal(self.option_lw, 'focus_change', self.update_imp_lb)
|
||||
|
||||
item_states = [(i,d['enabled']) for i,d in cf_dat.configuration_dict.iteritems()]
|
||||
@ -278,7 +286,7 @@ class InstConfigManager:
|
||||
self.option_lw.button_dict[opt].set_state(True)
|
||||
self.imp_lw_dict[opt].button_dict[imp].set_state(True)
|
||||
|
||||
dbg.msg(self.cf_msg_index, 'InstConfigManager:cf_statechange({},{},{}), cascade = {}'.format(b, new_state, udat, cascade))
|
||||
dbg.msg(self.cf_msg_index, 'InstConfigManager:cf_statechange({0},{1},{2}), cascade = {3}'.format(b, new_state, udat, cascade))
|
||||
self.cf_msg_index = (self.cf_msg_index - 7) % 2 + 8
|
||||
return
|
||||
|
||||
@ -293,7 +301,7 @@ class InstConfigManager:
|
||||
def update_imp_lb(self, pos):
|
||||
optname = self.options[pos][0]
|
||||
type = self.options[pos][1]
|
||||
mstr = 'InstConfigManager:update_imp_lb({}) -> select {}'.format(pos, type)
|
||||
mstr = 'InstConfigManager:update_imp_lb({0}) -> select {1}'.format(pos, type)
|
||||
dbg.msg(1, mstr)
|
||||
self.imp_lb.use_listwalker(self.imp_lw_dict[optname])
|
||||
return
|
||||
@ -354,7 +362,7 @@ class DEBUG:
|
||||
self.enabled = enabled
|
||||
if enabled:
|
||||
for msgID in self.msg_ids:
|
||||
msgText = urwid.Text(u'Space for message {}'.format(msgID))
|
||||
msgText = urwid.Text(u'Space for message {0}'.format(msgID))
|
||||
self.msgTextDict[msgID] = msgText
|
||||
self.msglist.append(urwid.AttrMap(msgText, 'body', 'focus'))
|
||||
|
||||
|
Reference in New Issue
Block a user