Package pyxmpp2 :: Package mainloop :: Module interfaces
[hide private]

Module interfaces

Abstract base classes for the main loop framework.
Classes [hide private]
  IOHandlerPrepareResult
Result of the IOHandler.prepare method.
  HandlerReady
Returned by the IOHandler.prepare method when the object is ready to handle I/O events and doesn't need further calls to the IOHandler.prepare method.
  PrepareAgain
Returned by the IOHandler.prepare method when the method needs to be called again.
  IOHandler
Wrapper for a socket or a file descriptor to be used in event loop or for I/O threads.
  Event
Base class for PyXMPP2 events.
  EventHandler
Base class for PyXMPP event handlers.
  TimeoutHandler
Base class for PyXMPP timeout handlers.
  MainLoop
Base class for main loop implementations.
Functions [hide private]
 
event_handler(event_class=None)
Method decorator generator for decorating event handlers.
 
timeout_handler(interval, recurring=None)
Method decorator generator for decorating event handlers.
Variables [hide private]
  QUIT = QuitEvent()
event (instance of a QuitEvent class) used to terminate the main event loop.
Function Details [hide private]

event_handler(event_class=None)

 

Method decorator generator for decorating event handlers.

To be used on EventHandler subclass methods only.

Such methods may return:
  • True: if they 'completely' handled the event and no more events should be called (use with care)
  • QUIT: to quit the main loop. Other handlers still will be called for current event and nother events in the queue.
Parameters:
  • event_class (subclass of Event) - event class expected

timeout_handler(interval, recurring=None)

 

Method decorator generator for decorating event handlers.

To be used on TimeoutHandler subclass methods only.

Parameters:
  • interval (float) - interval (in seconds) before the method will be called.
  • recurring (bool) - When True, the handler will be called each interval seconds, when False it will be called only once. If True, then the handler should return the next interval or None if it should not be called again.