def toConfigHolder(section, config, values): holder = ConfigHolder(section, config.name, config.description, config.long_desc) holder.items = [ ConfigItem(option, x.name, x.description, x.type, to_string(x.default), to_string(values.get(option, x.default))) for option, x in config.config.iteritems() ] return holder
def getConfig(self): """Retrieves complete config of core. :rtype: dict of section -> ConfigHolder """ data = {} for section, config, values in self.core.config.iterCoreSections(): holder = ConfigHolder(section, config.name, config.description, config.long_desc) holder.items = [ConfigItem(option, x.name, x.description, x.type, to_string(x.default), to_string(values.get(option, x.default))) for option, x in config.config.iteritems()] data[section] = holder return data
def getConfigValue(self, section, option): """Retrieve config value. :param section: name of category, or plugin :param option: config option :rtype: str :return: config value as string """ value = self.core.config.get(section, option, self.primaryUID) return to_string(value)
def toConfigHolder(section, config, values): holder = ConfigHolder(section, config.name, config.description, config.long_desc) holder.items = [ConfigItem(option, x.name, x.description, x.type, to_string(x.default), to_string(values.get(option, x.default))) for option, x in config.config.iteritems()] return holder