def templates(self): """ Get all available configuration templates. :rtype: dict """ import spreads.plugin templates = {'core': CORE_OPTIONS} if 'driver' in self.keys(): driver_name = self["driver"].get() templates['device'] = (spreads.plugin.get_driver(driver_name) .configuration_template()) plugins = spreads.plugin.get_plugins(*self["plugins"].get()) for name, plugin in plugins.iteritems(): tmpl = plugin.configuration_template() if tmpl: templates[name] = tmpl return templates
def templates(self): """ Get all available configuration templates. :rtype: dict """ import spreads.plugin templates = {'core': CORE_OPTIONS} if 'driver' in self.keys(): driver_name = self["driver"].get() templates['device'] = (spreads.plugin.get_driver( driver_name).configuration_template()) plugins = spreads.plugin.get_plugins(*self["plugins"].get()) for name, plugin in plugins.iteritems(): tmpl = plugin.configuration_template() if tmpl: templates[name] = tmpl return templates
def load_templates(self): """ Get all available configuration templates from the activated plugins. :returns: Mapping from plugin name to template mappings. :rtype: dict unicode -> (dict unicode -> :py:class:`OptionTemplate`) """ import spreads.plugin self.templates = {} self.templates['core'] = CORE_OPTIONS if 'driver' in self.keys(): driver_name = self["driver"].get() self.templates['device'] = (spreads.plugin.get_driver( driver_name).configuration_template()) plugins = spreads.plugin.get_plugins(*self["plugins"].get()) for name, plugin in plugins.iteritems(): tmpl = plugin.configuration_template() if tmpl: self.templates[name] = tmpl return self.templates
def load_templates(self): """ Get all available configuration templates from the activated plugins. :returns: Mapping from plugin name to template mappings. :rtype: dict unicode -> (dict unicode -> :py:class:`OptionTemplate`) """ import spreads.plugin self.templates = {} self.templates['core'] = CORE_OPTIONS if 'driver' in self.keys(): driver_name = self["driver"].get() self.templates['device'] = ( spreads.plugin.get_driver(driver_name) .configuration_template()) plugins = spreads.plugin.get_plugins(*self["plugins"].get()) for name, plugin in plugins.iteritems(): tmpl = plugin.configuration_template() if tmpl: self.templates[name] = tmpl return self.templates