Template¶
-
class
dasha.web.templates.Template(parent=None)[source]¶ Bases:
dasha.web.templates.IdTree,tollan.utils.namespace.NamespaceMixinAn abstract class that defines an encapsulated entity around a functional group of dash components and the callbacks.
One can do arbitrary nesting of templates through the
childfactory function, which returns a child template instance.Attributes Summary
Implement this to return a valid Dash layout object.
Methods Summary
after_setup_layout(self, app)Hook that run after the
setup_layoutfunction call.before_setup_layout(self, app)Hook that run before the
setup_layoutfunction call.child(self, factory, \*args, \*\*kwargs)Return a child template object.`.
Reset the template subclass registry.
from_dict(d, \*\*kwargs)Return a template instance specified by dict
d.setup_layout(self, app)Implement this to declare layout components and their callbacks.
Attributes Documentation
-
layout¶ Implement this to return a valid Dash layout object.
Methods Documentation
-
after_setup_layout(self, app)[source]¶ Hook that run after the
setup_layoutfunction call.
-
before_setup_layout(self, app)[source]¶ Hook that run before the
setup_layoutfunction call.
-
child(self, factory, \*args, \*\*kwargs)[source]¶ Return a child template object.`.
The actual creation of the object is delegated to the appropriate subclass based on the type of
factory:1.
factoryis aTemplateinstance. The instance is added as-is as the child of this object.ValueErroris raised ifargsorkwargsare set.2.
factoryis a Dash component class, (e.g.,Div). AComponentTemplateobject is created and returned.argsandkwargsare passed to the constructor.3.
factoryis a Dash component instance. The instance is wrapped in aComponentWrapperobject and returned.ValueErroris raised ifargsorkwargsare set.ValueErroris raised iffactorydoes not conform to the cases listed above.
-
classmethod
clear_registry()[source]¶ Reset the template subclass registry.
This is useful to make fresh reload of the flask instance.
-
classmethod
from_dict(d, \*\*kwargs)[source]¶ Return a template instance specified by dict
d.ValueErroris raised if “template” is not ind.
-