Ϫf dZddlmZddlmZddlmZddlmZddl m Z e eddejGd d ejZGd d ejZdd edeeeffdZdgZy)a This module provides support for Twisted to interact with the glib mainloop via GObject Introspection. In order to use this support, simply do the following:: from twisted.internet import gireactor gireactor.install() If you wish to use a GApplication, register it with the reactor:: from twisted.internet import reactor reactor.registerGApplication(app) Then use twisted.internet APIs as usual. On Python 3, pygobject v3.4 or later is required. )Union)GLib) _glibbase)ReactorAlreadyRunning)runtime threads_initNc"eZdZdZdZddZdZy) GIReactorz GObject-introspection event loop reactor. @ivar _gapplication: A C{Gio.Application} instance that was registered with C{registerGApplication}. NcNtjj|tdyN)rGlibReactorBase__init__r)selfuseGtks .runIs HHJ GGDMr) _gapplication RuntimeError_startedrhasattr_runr_crash)rrrs ` rregisterGApplicationzGIReactor.registerGApplication2su    )ST T =='G sF#7 !  hh rF)__name__ __module__ __qualname____doc__rrrrrr r $sM=rr c2eZdZdZdfd ZdZddZxZS)PortableGIReactorz< Portable GObject Introspection event loop reactor. c2t|td|y)Nr)superrr)rr __class__s rrzPortableGIReactor.__init__Ws tF3rctd)z Register a C{Gio.Application} or C{Gtk.Application}, whose main loop will be used instead of the default one. z3GApplication is not currently supported on Windows.)NotImplementedError)rrs rrz&PortableGIReactor.registerGApplicationZs ""WXXrcy)z5 For compatibility only. Do nothing. Nr%)rs rsimulatezPortableGIReactor.simulateasrr )returnN)r!r"r#r$rrr/ __classcell__)r+s@rr'r'Rs4Y rr'rr0ctjjdk(r t|}n t |}ddlm}|||S)z Configure the twisted mainloop to be run inside the glib mainloop. @param useGtk: A hint that the Gtk GUI will or will not be used. Currently does not modify any behavior. posixr)r)installReactor)rplatformgetTyper r'twisted.internet.mainr4)rreactorr4s rinstallr9gs?!W,6*#6247 Nrr9r )r$typingr gi.repositoryrtwisted.internetrtwisted.internet.errorrtwisted.pythonrgetattrrr r r'boolr9__all__r%rrrBs(&8" 4&2D+ ))+\ 11 *DU96G+G%H& +r