Package ocempgui :: Package events :: Module EventManager :: Class EventManager
[show private | hide private]
[frames | no frames]

Type EventManager

object --+
         |
        EventManager


EventManager () -> EventManager

An event distribution system.

The EventManager enables objects to receive events. Each object can register several signal types, on which occurance the EventManager will call the object's 'notify' method with that event.

Events also can be distributed by invoking the 'emit()' method of the EventManager.

Attributes: queues - A dict with signal-list associations of registered objects. event_grabber - The event grabbing object, which will receive all events.
Method Summary
  __init__(self)
  __len__(self)
E.__len__ () -> len (E)
  add_high_priority_object(self, obj, *signals)
E.add_high_priority_object (...) -> None
  add_object(self, obj, *signals)
E.add_object (...) -> None
  clear(self)
E.clear () -> None
  emit(self, signal, data)
E.emit (...) -> None
  emit_event(self, event)
E.emit_event (...) -> None
  grab_events(self, obj)
E.grab_events (...) -> None
  remove_object(self, obj, *signals)
E.remove_object (...) -> None
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  event_grabber: Sets the event grabber object.

Method Details

__len__(self)
(Length operator)

E.__len__ () -> len (E)

Returns the amount of objects within the EventManager

add_high_priority_object(self, obj, *signals)

E.add_high_priority_object (...) -> None

Adds a high priority object to the EventManager.

High priority objects do not differ from normal objects. Instead they are added in the first place to the signal queues instead of being appended to them like add_object() does. This results in notifying those objects in the first place.

Raises an AttributeError, if the passed 'obj' argument does not have a callable notify attribute.

add_object(self, obj, *signals)

E.add_object (...) -> None

Adds an object to the EventManger.

Adds an object as listener for one or more events to the EventManager. Each event type in the *signals argument will cause the object to be added to a respective queue, on which events with the same type will be emitted.

Raises an AttributeError, if the passed 'obj' argument does not have a callable notify attribute.

clear(self)

E.clear () -> None

Removes all objects and signals from all event queues.

emit(self, signal, data)

E.emit (...) -> None

Emits an event, which will be sent to the objects.

Emits an event on a specific queue of the EventManager, which will be sent to the objects in that queue. If one of the receiving objects sets the 'handled' attribute of the event to True, the emission will stop immediately so that following objects will not receive the event.

emit_event(self, event)

E.emit_event (...) -> None

Emits an event, which will be sent to the objects.

Emits an event on a specific queue of the EventManager, which will be sent to the objects in that queue. If one of the receiving objects sets the 'handled' attribute of the event to True, the emission will stop immediately so that following objects will not receive the event.

grab_events(self, obj)

E.grab_events (...) -> None

Sets an event grabber object for the EventManager.

Causes the EventManager to send _all_ its events only to this object instead of the objects in its queues. It is up to the event grabbing object to filter the events, it received.

remove_object(self, obj, *signals)

E.remove_object (...) -> None

Removes an object from the EventManager.

Removes the object from the queues passed as the 'signals' arguments. If 'signals' is None, the object will be removed from all queues of the EventManager.

Property Details

event_grabber

Sets the event grabber object.
Get Method:
unknown-687692852(...)
Set Method:
unknown-687692908(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 http://epydoc.sf.net