enaml.core.declarative

Functions

d_

Mark an Atom member as bindable from Enaml syntax.

Classes

Declarative

The most base class of the Enaml declarative objects.

enaml.core.declarative.d_(member, readable=True, writable=True, final=True)[source]

Mark an Atom member as bindable from Enaml syntax.

Parameters
  • member (Member) – The atom member to mark as bindable from Enaml syntax.

  • readable (bool, optional) – Whether the member is readable from Enaml syntax. The member must be readable to use the ‘>>’, ‘:=’, and ‘::’ operators. The default is True.

  • writable (bool, optional) – Whether the member is writable from Enaml syntax. The member must be writable to use the ‘=’, ‘<<’, and ‘:=’ operators. The default is True.

  • final (bool, optional) – Whether or not the member can be redefined from Enaml syntax using the ‘attr’ keyword. The default is True and indicates that the member cannot be overridden.

class enaml.core.declarative.Declarative(parent=None, **kwargs)[source]

Bases: enaml.core.object.Object

The most base class of the Enaml declarative objects.

This class provides the core functionality required of declarative Enaml types. It can be used directly in a declarative Enaml object tree to store and react to state changes. It has no concept of a visual representation; that functionality is added by subclasses.

name

Export the ‘name’ attribute as a declarative member.

initialized

An event fired when an object is initialized. It is triggered once during the object lifetime, at the end of the initialize method.

property is_initialized

A property which gets and sets the initialized flag. This should not be manipulated directly by user code.

initialize()[source]

Initialize this object all of its children recursively.

This is called to give the objects in the tree the opportunity to initialize additional state which depends upon the object tree being fully built. It is the responsibility of external code to call this method at the appropriate time. This will emit the initialized signal after all of the children have been initialized.

destroy()[source]

An overridden destructor method for declarative cleanup.

child_added(child)[source]

An overridden child added event handler.

This handler will automatically initialize a declarative child if this object itself has already been initialized.