Open deepankarsharma opened 10 years ago
For my own personal notes:
Declaring the alias after the full definition of the PushButton
would work, as would using a simple enamldef
for the button to encapsulate the bar
attr.
The Enaml compiler currently operates in two passes, the first pass builds an internal representation of the widget hierarchy, which is used to (among other things) instantiate the objects at runtime. The second pass adds the user-defined storage attributes and events, and wires up the aliases. This occurs in order of source code line number. The issue here is that the alias is being wired up before the storage attribute has been added to the push button.
I see two possible solutions 1) move the logic which adds the storage attributes to the first compiler pass, 2) move the alias wiring to a third compiler pass.
I would prefer solution number 1, but I can't recall at the moment if I had a good reason for adding the storage attributes during the second compiler pass.
Code pasted inline breaks currently.
from enaml.widgets.api import Window, Container, PushButton
enamldef Content(Container): """ The primary application content.
enamldef Main(Window): """ The main application window.