Package elisa :: Package base_components :: Module view :: Class View
[hide private]
[frames] | no frames]

Class View

source code


A View is responsible for rendering a Model. It can be of various nature such as graphics, audio or even network output. A View does not hold a direct reference to the Model it renders but accesses it through controller. It is notified of all the changes occuring to controller. Part of these changes can be treated automatically using the bindings system. A View can be part of a hierarchy of Views thus potentially having a reference to its parent and to its children defined in bindings. A View belongs to its frontend which encapsulates objects necessary for a View to be rendered (rendering context, theme, etc.)

Nested Classes [hide private]

Inherited from core.component.Component: __metaclass__

Instance Methods [hide private]
 
__init__(self)
Lazily set name from class name styled with underscores (class ComponentBar -> name component_bar.
source code
 
initialize(self)
Initialize various variables internal to the Component.
source code
 
clean(self)
Perform some cleanups and save the Component config back to application's config.
source code
 
frontend__get(self) source code
 
frontend__set(self, new_frontend) source code
 
frontend_changed(self, previous_frontend, new_frontend)
Called when frontend is set to a new value.
source code
 
controller__get(self) source code
 
controller__set(self, controller) source code
 
controller_changed(self, old_controller, new_controller)
Called when controller is set to a new value.
source code
 
update(self)
Refresh completely the rendering of the associated Controller.
source code
 
parent__set(self, parent) source code
 
parent__get(self) source code
 
attribute_set(self, origin, key, old_value, new_value)
Called when an attribute of the controller to which it is connected changes.
source code
 
_delete_bound_attributes(self, controller_attribute)
Delete view's attributes bound to controller_attribute.
source code
 
_update_bound_attributes(self, controller_attribute)
Update (create or delete) view's attribute bound to controller_attribute.
source code
 
_update_bound_view(self, attribute, controller)
Update (create or delete) a child view stored as attribute which is connected to controller.
source code
 
_create_child_view(self, attribute, path)
Create a View of type path and make it a child of self stored as an instance variable named after the content of attribute.
source code
 
_add_child_view(self, attribute, view)
Make view a child of self stored as an instance variable named after the content of attribute.
source code

Inherited from core.component.Component: load_config, save_config

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]

Inherited from core.component.Component: __classinit__

Class Variables [hide private]
tuple of strings supported_controllers = ('base:controller')
list of controllers that are compatible with the view identified by their path: 'plugin:controller'
dictionary: keys: strings; values: list of strings or strings bindings = {}
associations between model's attribute and Controller's attributes; if an attribute contained in bindings' keys is changed or created in model, it is replicated in all the corresponding attributes of the controller defined in bindings values
  context_path = 'frontend'
string name = 'view'
Component's name

Inherited from core.component.Component: checked, config_doc, default_config, id, plugin

Inherited from extern.log.log.Loggable: logCategory

Instance Variables [hide private]
any context_handle
DOCME
elisa.base_components.controller.Controller controller
controller to which the view is connected in order to access the model; setting it to an incompatible controller will fail
elisa.core.frontend.Frontend frontend
frontend to which the view belongs
elisa.base_components.view.View parent
parent view; None if the view is a root

Inherited from core.component.Component: config, path

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Lazily set name from class name styled with underscores (class ComponentBar -> name component_bar. Also set log category based on component name, with a 'comp_' prefix.
Overrides: core.component.Component.__init__
(inherited documentation)

initialize(self)

source code 

Initialize various variables internal to the Component.

This method is called by the plugin_registry after the component's config has been loaded.

Override this method if you need to perform some initializations that would normally go in Component's constructor but can't be done there because they require access to the component's config.
Overrides: core.component.Component.initialize
(inherited documentation)

clean(self)

source code 
Perform some cleanups and save the Component config back to application's config. This method should be called by the elisa.core.manager.Manager holding the component reference when it stops itself.
Overrides: core.component.Component.clean
(inherited documentation)

frontend_changed(self, previous_frontend, new_frontend)

source code 

Called when frontend is set to a new value.

Override if you wish to react to that change. Do not forget to call the parent class method.
Parameters:

controller_changed(self, old_controller, new_controller)

source code 

Called when controller is set to a new value.

Override if you wish to react to that change. Do not forget to call the parent class method.
Parameters:

update(self)

source code 
Refresh completely the rendering of the associated Controller. This should be called when the Controller has changed.

attribute_set(self, origin, key, old_value, new_value)

source code 
Called when an attribute of the controller to which it is connected changes.
Parameters:
  • key (string) - attribute changed
  • old_value (any) - value of the attribute before being set; None if attribute was not existing
  • new_value (any) - value of the attribute after being set
Overrides: core.observers.observer.Observer.attribute_set

_create_child_view(self, attribute, path)

source code 
Create a View of type path and make it a child of self stored as an instance variable named after the content of attribute.
Parameters:
  • attribute (string) - attribute of self where to store the newly created view
  • path (string) - path to the type of view which is to be created; syntax: plugin:component

_add_child_view(self, attribute, view)

source code 
Make view a child of self stored as an instance variable named after the content of attribute.
Parameters:
  • attribute (string) - attribute of self where to store the view
  • view - view to be made child

Instance Variable Details [hide private]

controller

controller to which the view is connected in order to access the model; setting it to an incompatible controller will fail
Get Method:
elisa.base_components.view.View.controller__get(self)
Set Method:
elisa.base_components.view.View.controller__set(self, controller)
Delete Method:
'frontend'

frontend

frontend to which the view belongs
Get Method:
elisa.base_components.view.View.frontend__get(self)
Set Method:
elisa.base_components.view.View.frontend__set(self, new_frontend)
Delete Method:
'frontend'

parent

parent view; None if the view is a root
Get Method:
elisa.base_components.view.View.parent__get(self)
Set Method:
elisa.base_components.view.View.parent__set(self, parent)
Delete Method:
'frontend'