enaml.stdlib.mapped_view

Classes

MappedView

A custom Include subtype which will automatically create a view based on the type of a given model object.

class enaml.stdlib.mapped_view.MappedView(parent=None, **kwargs)

Bases: enaml.core.include.Include

A custom Include subtype which will automatically create a view based on the type of a given model object.

Parameters
  • model (object) – The object acting as the model for this view. The mro of the type of this object is traversed to find a match in the given type map. If a match exists, the corresponding view is created.

  • typemap (dict) – A dictionary which maps object type to a callable which returns a view or iterable of views when invoked.

  • kwargs (dict, optional) – Additional keyword arguments to pass to the matching callable. The default is an empty dictionary.

  • modelkey (str, optional) – If non-empty, this key will be added to the dict of keyword arguments passed to a matching callable in the typemap. The value of the key will be the model instance associated with this AutoView. The default is ‘model’.

__reduce_ex__(proto)

An implementation of the reduce protocol.

This method creates a reduction tuple for enamldef instances. It is not part of the public Enaml api.