module documentation

This module provides base support for Twisted to interact with the glib/gtk mainloops.

The classes in this module should not be used directly, but rather you should import gireactor or gtk3reactor for GObject Introspection based applications, or glib2reactor or gtk2reactor for applications using legacy static bindings.

Class GlibReactorBase Base class for GObject event loop reactors.
Class GlibWaker Run scheduled events after waking up.
Function ensureNotImported Check whether the given modules were imported, and if requested, ensure they will not be importable in the future.
Function _loopQuitter Combine the glib.idle_add and glib.MainLoop.quit functions into a function suitable for crashing the reactor.
Function _signalGlue Integrate glib's wakeup file descriptor usage and our own.
def ensureNotImported(moduleNames, errorMessage, preventImports=[]): (source)

Check whether the given modules were imported, and if requested, ensure they will not be importable in the future.

Parameters
moduleNames:list of strA list of module names we make sure aren't imported.
errorMessage:strMessage to use when raising an ImportError.
preventImports:list of strA list of module name whose future imports should be prevented.
Raises
ImportErrorwith given error message if a given module name has already been imported.
def _loopQuitter(idleAdd: Callable[[Callable[[], None]], None], loopQuit: Callable[[], None]) -> Callable[[], None]: (source)

Combine the glib.idle_add and glib.MainLoop.quit functions into a function suitable for crashing the reactor.

def _signalGlue(): (source)

Integrate glib's wakeup file descriptor usage and our own.

Python supports only one wakeup file descriptor at a time and both Twisted and glib want to use it.

This is a context manager that can be wrapped around the whole glib reactor main loop which makes our signal handling work with glib's signal handling.