fixed lookup of description for keyed options

This commit is contained in:
SaltyBones 2017-07-10 21:31:31 +02:00
parent cc682d243f
commit e6840ab8b6
2 changed files with 7 additions and 15 deletions

View File

@ -166,8 +166,7 @@ class AdvancedConfigurationWindow(object):
# Get text from first column in this row
desc = None
if len(opt_path) == 3:
desc = gajim.config.get_desc_per(opt_path[2], opt_path[1],
opt_path[0])
desc = gajim.config.get_desc_per(opt_path[2], opt_path[0])
elif len(opt_path) == 1:
desc = gajim.config.get_desc(opt_path[0])
if desc:
@ -322,8 +321,7 @@ class AdvancedConfigurationWindow(object):
if model[it][Column.TYPE] != '':
opt_path = self.get_option_path(model, it)
if len(opt_path) == 3:
desc = gajim.config.get_desc_per(opt_path[2], opt_path[1],
opt_path[0])
desc = gajim.config.get_desc_per(opt_path[2], opt_path[0])
elif len(opt_path) == 1:
desc = gajim.config.get_desc(opt_path[0])
if search_string in model[it][Column.PREFERENCE_NAME] or (desc and \

View File

@ -746,21 +746,15 @@ class Config:
return None
return dict_[subname][Option.TYPE][0]
def get_desc_per(self, optname, key=None, subname=None):
def get_desc_per(self, optname, subname=None):
if optname not in self.__options_per_key:
return None
dict_ = self.__options_per_key[optname][0]
if not key:
if subname not in dict_:
return None
if key not in dict_:
return None
obj = dict_[key]
if not subname:
return None
if subname not in obj:
return None
if len(obj[subname]) > Option.DESC:
return obj[subname][Option.DESC]
obj = dict_[subname]
if len(obj) > Option.DESC:
return obj[Option.DESC]
return None
def get_restart_per(self, optname, key=None, subname=None):