HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/internet/__pycache__/gireactor.cpython-310.pyc
o

�b�@s�dZddlZddlmZddlmZddlmZddl	m
Z
dZej�
�eedd�dur1e��Gd	d
�d
ej�ZGdd�dej�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.
�N)�GLib)�	_glibbase)�ReactorAlreadyRunning)�runtimeT�threads_initc@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}.
    NFcC�0d}|durddlm}tjj|t||d�dS�NTr)�Gtk��useGtk)�
gi.repositoryr
r�GlibReactorBase�__init__r��selfr�_gtk�r�</usr/lib/python3/dist-packages/twisted/internet/gireactor.pyrE�zGIReactor.__init__csV|jdur	td��|jrtd��t�d�std���|_�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)�hold�runr��apprrrcsz+GIReactor.registerGApplication.<locals>.run)�
_gapplication�RuntimeError�_startedr�hasattr�_runr�_crash)rrrrrr�registerGApplicationLs

�
�zGIReactor.registerGApplication�F)�__name__�
__module__�__qualname__�__doc__r�IOCondition�HUP�ERR�NVAL�_POLL_DISCONNECTED�IN�_POLL_IN�OUT�	_POLL_OUT�INFLAGS�OUTFLAGSrrr!rrrrr.s�
rc@s"eZdZdZddd�Zdd�ZdS)	�PortableGIReactorz<
    Portable GObject Introspection event loop reactor.
    FcCrr	)r
r
r�PortableGlibReactorBaserrrrrrrqrzPortableGIReactor.__init__cCstd��)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)rrrrrr!xsz&PortableGIReactor.registerGApplicationNr")r#r$r%r&rr!rrrrr2ls
r2FcCs<tj��dkr
t|d�}nt|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�platform�getTyperr2�twisted.internet.mainr6)r�reactorr6rrr�install�s
r;r")r&�gi.pygtkcompat�gir
r�twisted.internetr�twisted.internet.errorr�twisted.pythonr�_pygtkcompatPresent�pygtkcompat�enable�getattrrrrr3r2r;�__all__rrrr�<module>s
>