Package elisa :: Package core :: Module input_manager :: Class InputManager
[hide private]
[frames] | no frames]

Class InputManager

source code


InputManager provides a common place to retrieve input events coming from a GUI toolkit, additional input sources or even a network. InputEvents can be pushed by elisa.base_components.input_provider.InputProviders or be polled by the InputManager, depending on the implementation chosen: elisa.base_components.input_provider.PollInputProvider or elisa.base_components.input_provider.PushInputProvider.

Other objects can connect to the manager's signals that are emitted when elisa.core.input_event.InputEvents coming from elisa.base_components.input_provider.InputProviders are received.

Nested Classes [hide private]

Inherited from manager.Manager: __metaclass__

Instance Methods [hide private]
 
__init__(self)
Initialize the _components instance variable and the Manager as a Loggable object.
source code
 
start(self)
Start a polling loop that will regularly check the registered elisa.base_components.input_provider.PollInputProviders for new elisa.core.input_event.InputEvents.
source code
twisted.internet.defer.DeferredList
stop(self)
Clean all the registered elisa.base_components.input_provider.InputProviders and stop polling for new elisa.core.input_event.InputEvents.
source code
 
process_event(self, event, provider_path)
Fire the signal corresponding to the event.
source code
 
register_component(self, component)
Register a new InputProvider in the InputManager so that the events collected by the former are propagated by the latter.
source code
 
unregister_component(self, component)
Clean the InputProvider and unregister it from the InputManager; no events from the InputProvider will be propagated anymore.
source code
 
subscribe(self, provider_path, callback)
Register a callback which will be called whenever an elisa.core.input_event.InputEvent coming from the given elisa.base_components.input_provider.InputProvider is raised.
source code
 
unsubscribe(self, provider_path, callback)
Unregister a previously registered callback against a given elisa.base_components.input_provider.InputProvider.
source code
 
_poll_events(self)
Poll each registered PollInputProvider for InputEvents to process.
source code
 
_emit_event(self, event, provider_path)
Emit an event coming from a given InputProvider
source code

Inherited from manager.Manager: component_registered, initialize

Inherited from manager.Manager (private): _load_providers

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 manager.Manager: __classinit__

Class Variables [hide private]
  name = 'input_manager'

Inherited from extern.log.log.Loggable: logCategory

Instance Variables [hide private]

Inherited from manager.Manager (private): _components

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Initialize the _components instance variable and the Manager as a Loggable object.
Overrides: manager.Manager.__init__
(inherited documentation)

start(self)

source code 
Start a polling loop that will regularly check the registered elisa.base_components.input_provider.PollInputProviders for new elisa.core.input_event.InputEvents.
Overrides: manager.Manager.start

stop(self)

source code 
Clean all the registered elisa.base_components.input_provider.InputProviders and stop polling for new elisa.core.input_event.InputEvents.
Returns: twisted.internet.defer.DeferredList
Overrides: manager.Manager.stop

process_event(self, event, provider_path)

source code 

Fire the signal corresponding to the event.

Each event type is mapped to a signal instance to which other elisa components can connect (e.g to monitor user key presses).

This method can be called by elisa.base_components.input_provider.PushInputProvider components when they receive input data from the input device.
Parameters:

register_component(self, component)

source code 
Register a new InputProvider in the InputManager so that the events collected by the former are propagated by the latter.
Parameters:
Overrides: manager.Manager.register_component

unregister_component(self, component)

source code 
Clean the InputProvider and unregister it from the InputManager; no events from the InputProvider will be propagated anymore.
Parameters:
Overrides: manager.Manager.unregister_component

subscribe(self, provider_path, callback)

source code 

Register a callback which will be called whenever an elisa.core.input_event.InputEvent coming from the given elisa.base_components.input_provider.InputProvider is raised.

The first argument passed to the callback will be a elisa.core.input_event.InputEvent instance.
Parameters:
  • provider_path (str) - the path of the InputProvider from which the events will come from
  • callback (callable) - the object to be called when an event is raised

unsubscribe(self, provider_path, callback)

source code 
Unregister a previously registered callback against a given elisa.base_components.input_provider.InputProvider. Events will no longer be forwarded to the callback.
Parameters:
  • provider_path (str) - the path of the InputProvider from which the events used to come from
  • callback (callable) - the already registered callback