Package tdi :: Package tools :: Module template :: Class Loader
[frames] | no frames]

Class Loader

source code

object --+
         |
        Loader

Find, load and select templates
Instance Methods
 
__init__(self, list, load, select)
Initialization
source code
bool
autoreload(self)
Autoreload templates?
source code
tdi.template.Template
load(self, name)
Load a single template and register the autoupdate callback
source code
dict
available(self)
Determine automatic overlay -> template name mapping
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, list, load, select)
(Constructor)

source code 
Initialization
Parameters:
  • list (callable) - Template lister. This function is called without parameters and expected to return a list of all template names available. Template names are hashable tokens (such as strings) identifying the templates. They are passed to the load function if the template needs to be loaded.
  • load (callable) - Template loader. This function is called with a template name as parameter and expected to return the actual template object.
  • select (callable) - Template selector. This function is called with two parameters: The loader instance (self) and the template name. It is expected to return a bool value, which decides whether this template is in the pool for automatic templates or not.
Overrides: object.__init__

autoreload(self)

source code 
Autoreload templates?
Returns: bool
Autoreloading available?

load(self, name)

source code 
Load a single template and register the autoupdate callback
Parameters:
  • name (hashable) - Template name
Returns: tdi.template.Template
The template

available(self)

source code 

Determine automatic overlay -> template name mapping

This method should only list the automatic overlay mappings.

Returns: dict
source overlay name -> set(template name)