HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/twisted/internet/__pycache__/gireactor.cpython-38.pyc
U


W[��@sdZddlmZmZddlmZddlmZddlm	Z	ddl
mZerNdZn6ddl
mZdZzed	Wnek
r�d
ZYnXddd
dgZdd�Zes�e�n6ddlZej��ddlmaetdd�dk	r�t��Gdd�de	j�ZGdd�de	j�Zddd�ZdgZdS)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.
�)�division�absolute_import)�_PY3)�ReactorAlreadyRunning)�	_glibbase)�runtimeT)�
theSystemPathzgi.pygtkcompatFZgobjectZglibZgioZgtkcCsDt�td�ddlmattdd�dk	r0t��tjgdtd�dS)za
    Make sure pygtk and gi aren't loaded at the same time, and import Glib if
    possible.
    z|Introspected and static glib/gtk bindings must not be mixed; can't import gireactor since pygtk2 module is already imported.r��GLib�threads_initN�)ZpreventImports)rZensureNotImported�_PYGTK_MODULES�
gi.repositoryr
�getattrr�rr�</usr/lib/python3/dist-packages/twisted/internet/gireactor.py�
_oldGiInit1s��rNr	rc@s^eZdZdZejjejjBejjBZ	ejj
ZejjZ
ee	BZe
e	BZdZddd�Zdd�ZdS)	�	GIReactorz�
    GObject-introspection event loop reactor.

    @ivar _gapplication: A C{Gio.Application} instance that was registered
        with C{registerGApplication}.
    NFcCs0d}|dkrddlm}tjj|t||d�dS�NTr)�Gtk��useGtk)rrr�GlibReactorBase�__init__r
��selfrZ_gtkrrrrpszGIReactor.__init__csV|jdk	rtd��|jr td��t�d�s2td���|_�fdd�}||_�j|_dS)a�
        Register a C{Gio.Application} or C{Gtk.Application}, whose main loop
        will be used instead of the default one.

        We will C{hold} the application so it doesn't exit on its own. In
        versions of C{python-gi} 3.2 and later, we exit the event loop using
        the C{app.quit} method which overrides any holds. Older versions are
        not supported.
        Nz2Can't register more than one application instance.z5Can't register application after reactor was started.�quitzPApplication registration is not supported in versions of PyGObject prior to 3.2.cs�����d�dS)N)Zhold�runr��apprrr�sz+GIReactor.registerGApplication.<locals>.run)�
_gapplication�RuntimeErrorZ_startedr�hasattrZ_runrZ_crash)rrrrrr�registerGApplicationxs

��
zGIReactor.registerGApplication)F)�__name__�
__module__�__qualname__�__doc__r
ZIOConditionZHUPZERRZNVALZ_POLL_DISCONNECTED�INZ_POLL_INZOUTZ	_POLL_OUTZINFLAGSZOUTFLAGSr rr#rrrrrZs�
rc@s"eZdZdZddd�Zdd�ZdS)	�PortableGIReactorz<
    Portable GObject Introspection event loop reactor.
    FcCs0d}|dkrddlm}tjj|t||d�dSr)rrr�PortableGlibReactorBaserr
rrrrr�s�zPortableGIReactor.__init__cCstd��dS)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.N)�NotImplementedError)rrrrrr#�sz&PortableGIReactor.registerGApplicationN)F)r$r%r&r'rr#rrrrr)�s
	r)cCs<tj��dkrt|d�}n
t|d�}ddlm}||�|S)z�
    Configure the twisted mainloop to be run inside the glib mainloop.

    @param useGtk: should GTK+ rather than glib event loop be
        used (this will be slightly slower but does support GUI).
    �posixrr)�installReactor)r�platformZgetTyperr)Ztwisted.internet.mainr-)rZreactorr-rrr�install�s
r/)F) r'Z
__future__rrZtwisted.python.compatrZtwisted.internet.errorrZtwisted.internetrZtwisted.pythonrZ_pygtkcompatPresentZtwisted.python.modulesr�KeyErrorr
rZgi.pygtkcompatZgiZpygtkcompat�enablerr
rrrrr*r)r/�__all__rrrr�<module>s4

;