Always show selected_imp in the implementation list for an option.
Fix imp_statechange bug (imp undefined for disabled options).
This commit is contained in:
@@ -443,7 +443,7 @@ class InstConfigManager:
|
||||
self.opt_lb.set_focus(0)
|
||||
return
|
||||
|
||||
def __imp_unavailable(self, imp):
|
||||
def __imp_unavailable(self, opt, imp):
|
||||
"""Return True if an implementation is unavailable because it is used
|
||||
by an enabled option.
|
||||
"""
|
||||
@@ -453,6 +453,10 @@ class InstConfigManager:
|
||||
ckopt = self.cf_dat.imp2opt_dict[imp]
|
||||
if ckopt == 'none':
|
||||
return False
|
||||
|
||||
opt_imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
||||
if opt_imp == imp:
|
||||
return False
|
||||
elif self.cf_dat.opt_dict[ckopt]['enabled']:
|
||||
return True
|
||||
else:
|
||||
@@ -462,7 +466,7 @@ class InstConfigManager:
|
||||
"""Generate the appropriate listwalker for the given option."""
|
||||
imp_items = []
|
||||
for imp in self.cf_dat.iter_implementations(opt):
|
||||
if self.__imp_unavailable(imp):
|
||||
if self.__imp_unavailable(opt, imp):
|
||||
continue
|
||||
if imp == self.cf_dat.opt_dict[opt]['selected_imp']:
|
||||
imp_items.append((imp, True))
|
||||
@@ -509,7 +513,7 @@ class InstConfigManager:
|
||||
opt = button.get_label().split(':')[0]
|
||||
imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
||||
if new_state == True:
|
||||
if self.__imp_unavailable(imp):
|
||||
if self.__imp_unavailable(opt, imp):
|
||||
self.cf_dat.opt_dict[opt]['selected_imp'] = 'none'
|
||||
imp_none_button = self.imp_lw.button_dict['none']
|
||||
imp_none_button.set_state(True)
|
||||
@@ -526,8 +530,8 @@ class InstConfigManager:
|
||||
"""Update label on the configuration option when it's implementation is
|
||||
changed.
|
||||
"""
|
||||
if new_state == True:
|
||||
imp = button.get_label()
|
||||
if new_state == True:
|
||||
self.cf_dat.set_imp(opt, imp)
|
||||
opt_button = self.opt_lw.button_dict[opt]
|
||||
opt_button.set_label('{0}:{1}'.format(opt, imp))
|
||||
|
||||
Reference in New Issue
Block a user