Module vlc :: Class EventManager
[hide private]
[frames] | no frames]

Class EventManager

source code

object --+    
         |    
    _Ctype --+
             |
            EventManager

Create an event manager with callback handler.

This class interposes the registration and handling of event notifications in order to (a) remove the need for decorating each callback functions with the decorator '@callbackmethod', (b) allow any number of positional and/or keyword arguments to the callback (in addition to the Event instance) and (c) to preserve the Python objects such that the callback and argument objects remain alive (i.e. are not garbage collected) until after the notification has been unregistered.


Note: Only a single notification can be registered for each event type in an EventManager instance.

Instance Methods [hide private]
 
event_attach(self, eventtype, callback, *args, **kwds)
Register an event notification.
source code
 
event_detach(self, eventtype)
Unregister an event notification.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, ptr=<__builtin__.object object>) source code

Inherited from _Ctype: from_param

Class Variables [hide private]
  _callback_handler = None
  _callbacks = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(cls, ptr=<__builtin__.object object>)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

event_attach(self, eventtype, callback, *args, **kwds)

source code 

Register an event notification.

Parameters:
  • eventtype - the desired event type to be notified about.
  • callback - the function to call when the event occurs.
  • args - optional positional arguments for the callback.
  • kwds - optional keyword arguments for the callback.
Returns:
0 on success, ENOMEM on error.

Note: The callback function must have at least one argument, an Event instance. Any other, optional positional and keyword arguments are in addition to the first one. Warning: libvlc is not reentrant, i.e. you cannot call libvlc functions from an event handler. They must be called from the main application thread.

event_detach(self, eventtype)

source code 

Unregister an event notification.

Parameters:
  • eventtype - the event type notification to be removed.