Package pyxmpp2 :: Package mainloop :: Module base :: Class MainLoopBase
[hide private]

Class MainLoopBase


Base class for main loop implementations.
Nested Classes [hide private]

Inherited from interfaces.MainLoop: __metaclass__

Instance Methods [hide private]
 
__init__(self, settings=None, handlers=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
add_handler(self, handler)
Add a new handler to the main loop.
 
remove_handler(self, handler)
Add a new handler to the main loop.
 
_add_io_handler(self, handler)
Add an IOHandler to the loop.
 
_remove_io_handler(self, handler)
Remove an IOHandler from the loop.
 
quit(self)
Make the loop stop after the current iteration.
 
loop(self, timeout=None)
Run the loop.
 
loop_iteration(self, timeout=1)
Single loop iteration.
 
check_events(self)
Call the event dispatcher.
 
_add_timeout_handler(self, handler)
Add a TimeoutHandler to the main loop.
 
_remove_timeout_handler(self, handler)
Remove TimeoutHandler from the main loop.
 
_call_timeout_handlers(self)
Call the timeout handlers due.

Inherited from interfaces.MainLoop: delayed_call

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

Class Variables [hide private]
  __abstractmethods__ = frozenset([])
Properties [hide private]
  finished
True then the loop has been finished or is about to finish (the final iteration in progress).
  started
True then the loop has been started.

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings=None, handlers=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

add_handler(self, handler)

 
Add a new handler to the main loop.
Parameters:
  • handler - the handler object to add
Overrides: interfaces.MainLoop.add_handler
(inherited documentation)

remove_handler(self, handler)

 

Add a new handler to the main loop.

Do nothing if the handler is not registered at the main loop.

Parameters:
  • handler - the handler object to add
Overrides: interfaces.MainLoop.remove_handler
(inherited documentation)

quit(self)

 
Make the loop stop after the current iteration.
Overrides: interfaces.MainLoop.quit
(inherited documentation)

loop(self, timeout=None)

 
Run the loop.
Parameters:
  • timeout - time to loop, if not given the method will run until finished
Overrides: interfaces.MainLoop.loop
(inherited documentation)

loop_iteration(self, timeout=1)

 
Single loop iteration.
Parameters:
  • timeout - maximum time (in seconds) to block for
Overrides: interfaces.MainLoop.loop_iteration
(inherited documentation)

check_events(self)

 

Call the event dispatcher.

Quit the main loop when the QUIT event is reached.

Returns:
True if QUIT was reached.

_call_timeout_handlers(self)

 
Call the timeout handlers due.
Returns:
(next_event_timeout, sources_handled) tuple. next_event_timeout is number of seconds until the next timeout event, sources_handled is number of handlers called.

Property Details [hide private]

finished

True then the loop has been finished or is about to finish (the final iteration in progress).
Get Method:
unreachable.finished(self)

started

True then the loop has been started.
Get Method:
unreachable.started(self)