Provide navigation context for __imp_unavailable method.
This commit is contained in:
@ -445,7 +445,7 @@ class InstConfigManager(object):
|
|||||||
self.opt_lb.set_focus(0)
|
self.opt_lb.set_focus(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
def __imp_unavailable(self, opt, imp):
|
def __imp_unavailable(self, opt, imp, action):
|
||||||
"""Return True if an implementation is unavailable because it is used
|
"""Return True if an implementation is unavailable because it is used
|
||||||
by an enabled option.
|
by an enabled option.
|
||||||
"""
|
"""
|
||||||
@ -457,10 +457,18 @@ class InstConfigManager(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
opt_imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
opt_imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
||||||
if opt_imp == imp:
|
if (action == 'focus'):
|
||||||
return False
|
if opt_imp == imp:
|
||||||
elif self.cf_dat.opt_dict[ckopt]['enabled']:
|
return False
|
||||||
return True
|
elif self.cf_dat.opt_dict[ckopt]['enabled']:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
elif (action == 'state_change'):
|
||||||
|
if self.cf_dat.opt_dict[ckopt]['enabled']:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -468,7 +476,7 @@ class InstConfigManager(object):
|
|||||||
"""Generate the appropriate listwalker for the given option."""
|
"""Generate the appropriate listwalker for the given option."""
|
||||||
imp_items = []
|
imp_items = []
|
||||||
for imp in self.cf_dat.iter_implementations(opt):
|
for imp in self.cf_dat.iter_implementations(opt):
|
||||||
if self.__imp_unavailable(opt, imp):
|
if self.__imp_unavailable(opt, imp, 'focus'):
|
||||||
continue
|
continue
|
||||||
if imp == self.cf_dat.opt_dict[opt]['selected_imp']:
|
if imp == self.cf_dat.opt_dict[opt]['selected_imp']:
|
||||||
imp_items.append((imp, True))
|
imp_items.append((imp, True))
|
||||||
@ -514,12 +522,14 @@ class InstConfigManager(object):
|
|||||||
opt = button.get_label().split(':')[0]
|
opt = button.get_label().split(':')[0]
|
||||||
imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
imp = self.cf_dat.opt_dict[opt]['selected_imp']
|
||||||
if new_state == True:
|
if new_state == True:
|
||||||
if self.__imp_unavailable(opt, imp):
|
if self.__imp_unavailable(opt, imp, 'state_change'):
|
||||||
self.cf_dat.opt_dict[opt]['selected_imp'] = 'none'
|
self.cf_dat.opt_dict[opt]['selected_imp'] = 'none'
|
||||||
imp_none_button = self.imp_lw.button_dict['none']
|
imp_none_button = self.imp_lw.button_dict['none']
|
||||||
imp_none_button.set_state(True)
|
imp_none_button.set_state(True)
|
||||||
opt_button = self.opt_lw.button_dict[opt]
|
opt_button = self.opt_lw.button_dict[opt]
|
||||||
opt_button.set_label('{0}:none'.format(opt))
|
opt_button.set_label('{0}:none'.format(opt))
|
||||||
|
self.imp_lw = self.__gen_imp_listwalker(opt)
|
||||||
|
self.imp_lb.use_listwalker(self.imp_lw)
|
||||||
else:
|
else:
|
||||||
opt_button = self.opt_lw.button_dict[opt]
|
opt_button = self.opt_lw.button_dict[opt]
|
||||||
opt_button.set_label('{0}:{1}'.format(opt, imp))
|
opt_button.set_label('{0}:{1}'.format(opt, imp))
|
||||||
@ -605,6 +615,7 @@ class DEBUG:
|
|||||||
|
|
||||||
DBG = DEBUG(enabled=True)
|
DBG = DEBUG(enabled=True)
|
||||||
def main(config_ini):
|
def main(config_ini):
|
||||||
|
global cf_dat, cf_man, cf_viewer
|
||||||
"""Create configuration editor."""
|
"""Create configuration editor."""
|
||||||
|
|
||||||
# Make configuration data
|
# Make configuration data
|
||||||
|
Reference in New Issue
Block a user