Package elisa :: Package base_components :: Module controller :: Class Controller
[hide private]
[frames] | no frames]

Class Controller

source code


Connects to a compatible elisa.base_components.model.Model and holds extra information useful for a elisa.base_components.view.View to render the model. It is notified of all the changes occuring to model. Part of these changes can be treated automatically using the bindings system. A Controller can be part of a hierarchy of Controllers thus potentially having a reference to its parent and to its children defined in bindings.

DOCME: focus, focused, branch of focused controllers, backend.

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
 
focus(self)
Grab the focus.
source code
 
focused__get(self) source code
 
focused__set(self, focused) source code
 
focused_changed(self, old_focused, new_focused)
Called when focused is set to a new value.
source code
 
backend__get(self) source code
 
backend__set(self, new_backend) source code
 
backend_changed(self, old_backend, new_backend)
Called when backend is set to a new value.
source code
 
parent__set(self, parent) source code
 
parent__get(self) source code
 
model__get(self) source code
 
model__set(self, model) source code
 
model_changed(self, old_model, new_model)
Called when model is set to a new value.
source code
bool
handle_input(self, input_event)
Process an input event.
source code
 
attribute_set(self, origin, key, old_value, new_value)
Called when an attribute of the model to which it is connected changes.
source code
 
_delete_bound_attributes(self, model_attribute)
Delete controller's attributes bound to model_attribute.
source code
 
_update_bound_attributes(self, model_attribute)
Update (create or delete) controller's attribute bound to model_attribute.
source code
 
_update_bound_controller(self, attribute, model)
Update (create or delete) a child controller stored as attribute which is connected to model.
source code
 
_create_child_controller(self, attribute, path)
Create a Controller 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_controller(self, attribute, controller)
Make controller a child of self stored as an instance variable named after the content of attribute.
source code

Inherited from core.component.Component: clean, load_config, save_config

Inherited from core.observers.observable.Observable: __setattr__, add_observer, remove_observer

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__, __str__

Static Methods [hide private]

Inherited from core.component.Component: __classinit__

Class Variables [hide private]
tuple of strings supported_models = ('base:model')
list of models that are compatible with the controller identified by their path: 'plugin:model'
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
string name = 'controller'
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]
elisa.core.backend.Backend backend
backend to which the controller belongs
boolean focused
DOCME
elisa.base_components.model.Model model
model to which the controller is connected; setting it to an incompatible model will fail
elisa.base_components.controller.Controller parent
parent controller; None if the controller 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)

focus(self)

source code 
Grab the focus. The controller previously owning the focus loses it.

focused_changed(self, old_focused, new_focused)

source code 

Called when focused 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:
  • old_focused (bool) - value of focused before
  • new_focused (bool) - value of focused now

backend_changed(self, old_backend, new_backend)

source code 

Called when backend 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:

model_changed(self, old_model, new_model)

source code 

Called when model 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:

handle_input(self, input_event)

source code 
Process an input event. It can decide that no further processing should be done by returning True or let its parent controller process it by returning False.
Parameters:
Returns: bool

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

source code 
Called when an attribute of the model 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_controller(self, attribute, path)

source code 
Create a Controller 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 controller
  • path (string) - path to the type of controller which is to be created; syntax: plugin:component

_add_child_controller(self, attribute, controller)

source code 
Make controller 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 controller
  • controller - controller to be made child

Instance Variable Details [hide private]

backend

backend to which the controller belongs
Get Method:
elisa.base_components.controller.Controller.backend__get(self)
Set Method:
elisa.base_components.controller.Controller.backend__set(self, new_backend)
Delete Method:
'frontend'

focused

DOCME
Get Method:
elisa.base_components.controller.Controller.focused__get(self)
Set Method:
elisa.base_components.controller.Controller.focused__set(self, focused)
Delete Method:
'frontend'

model

model to which the controller is connected; setting it to an incompatible model will fail
Get Method:
elisa.base_components.controller.Controller.model__get(self)
Set Method:
elisa.base_components.controller.Controller.model__set(self, model)
Delete Method:
'frontend'

parent

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