enaml.applib.live_editor_model
Classes
A model which works in concert with the live editor panels. |
- class enaml.applib.live_editor_model.LiveEditorModel[source]
Bases:
Atom
A model which works in concert with the live editor panels.
This model manages the compiling and instantiation of the model and view objects defined by the user.
The model has six inputs:
- ‘model_text’
The full text of the Python module which defines the model.
- ‘view_text’
The full text of the Enaml module which defines the view.
- ‘model_item’
The name of the target model class in the model module.
- ‘view_item’
The name of the target enamldef in the view module.
- ‘model_filename’
An optional filename to associate with the model module.
- ‘view_filename’
An optional filename to associate with the view module.
The model has three outputs:
- ‘compiled_model’
The instance of the user defined model, or None if no model could be created.
- ‘compiled_view’
The instance of the user defined view, or None if no view could be created.
- ‘traceback’
A string holding the traceback for any compilation and instantiation errors.
If the ‘compiled_view’ object has a ‘model’ attribute, then the ‘compiled_model’ object will be assigned to that attribute.
- compiled_model
The current live model object bound to the main view.
- compiled_view
The current live view object to include in the main view.
- model_text
The Python module input text for the model module.
- view_text
The Enaml module input text for the view module.
- model_item
The string name of the Atom class to use as the model.
- view_item
The string name of the enamldef to use as the view.
- model_filename
An optional filename to use when compiling the python code.
- view_filename
An optional filename to use when compiling the enaml code.
- traceback
A string which holds the most recent traceback.
- refresh_model()[source]
Refresh the compiled model object.
This method will (re)compile the model for the given model text and update the ‘compiled_model’ attribute. If a compiled view is available and has a member named ‘model’, the model will be applied to the view.
- refresh_view()[source]
Refresh the compiled view object.
This method will (re)compile the view for the given view text and update the ‘compiled_view’ attribute. If a compiled model is available and the view has a member named ‘model’, the model will be applied to the view.