Shorter completion header texts

This commit is contained in:
Florian Bruhin 2014-05-04 18:06:25 +02:00
parent 677678be81
commit 970d8fd7ba

View File

@ -34,7 +34,7 @@ class SettingSectionCompletionModel(BaseCompletionModel):
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent) super().__init__(parent)
cat = self.new_category("Config sections") cat = self.new_category("Sections")
for name in configdata.DATA.keys(): for name in configdata.DATA.keys():
desc = configdata.SECTION_DESC[name].splitlines()[0].strip() desc = configdata.SECTION_DESC[name].splitlines()[0].strip()
self.new_item(cat, name, desc) self.new_item(cat, name, desc)
@ -53,7 +53,7 @@ class SettingOptionCompletionModel(BaseCompletionModel):
def __init__(self, section, parent=None): def __init__(self, section, parent=None):
super().__init__(parent) super().__init__(parent)
cat = self.new_category("Config options for {}".format(section)) cat = self.new_category(section)
sectdata = configdata.DATA[section] sectdata = configdata.DATA[section]
self._misc_items = {} self._misc_items = {}
self._section = section self._section = section
@ -91,15 +91,14 @@ class SettingValueCompletionModel(BaseCompletionModel):
super().__init__(parent) super().__init__(parent)
if hasattr(configdata.DATA[section], 'valtype'): if hasattr(configdata.DATA[section], 'valtype'):
# Same type for all values (ValueList) # Same type for all values (ValueList)
cat = self.new_category("Setting values for {} options".format( cat = self.new_category(section)
section))
vals = configdata.DATA[section].valtype.complete() vals = configdata.DATA[section].valtype.complete()
else: else:
if option is None: if option is None:
raise ValueError("option may only be None for ValueList " raise ValueError("option may only be None for ValueList "
"sections, but {} is not!".format(section)) "sections, but {} is not!".format(section))
# Different type for each value (KeyValue) # Different type for each value (KeyValue)
cat = self.new_category("Setting values for {}".format(option)) cat = self.new_category(option)
vals = configdata.DATA[section][option].typ.complete() vals = configdata.DATA[section][option].typ.complete()
if vals is None: if vals is None:
raise NoCompletionsError raise NoCompletionsError