o
    ¯b8  ã                	   @   sÐ   d Z ddlZddlmZ ddlmZ zeedƒs!ddlZe d¡ W n e	e
fy-   Y nw ddlZeedƒr;e ¡  G dd	„ d	ejƒZG d
d„ dejƒZddd„Zddd„Zej ¡ dkraeZneZdgZdS )a>  
This module provides support for Twisted to interact with the glib/gtk2
mainloop.

In order to use this support, simply do the following::

    from twisted.internet import gtk2reactor
    gtk2reactor.install()

Then use twisted.internet APIs as usual.  The other methods here are not
intended to be called directly.
é    N)Ú	_glibbase)ÚruntimeÚfrozenz2.0Úthreads_initc                   @   sH   e Zd ZdZejejB ejB Zej	Z
ejZe
eB ZeeB Zddd„ZdS )ÚGtk2Reactorz&
    PyGTK+ 2 event loop reactor.
    Tc                 C   ó,   d }|du r
dd l }tjj| t||d� d S ©NTr   )ÚuseGtk)Úgtkr   ÚGlibReactorBaseÚ__init__Úgobject©Úselfr	   Ú_gtk© r   ú>/usr/lib/python3/dist-packages/twisted/internet/gtk2reactor.pyr   F   ó   zGtk2Reactor.__init__N©T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚIO_HUPÚIO_ERRÚIO_NVALÚ_POLL_DISCONNECTEDÚIO_INÚ_POLL_INÚIO_OUTÚ	_POLL_OUTÚINFLAGSÚOUTFLAGSr   r   r   r   r   r   7   s    r   c                   @   s   e Zd ZdZddd„ZdS )ÚPortableGtkReactorzd
    Reactor that works on Windows.

    Sockets aren't supported by GTK+'s input_add on Win32.
    Tc                 C   r   r   )r
   r   ÚPortableGlibReactorBaser   r   r   r   r   r   r   U   r   zPortableGtkReactor.__init__Nr   )r   r   r   r   r   r   r   r   r   r#   N   s    r#   Tc                 C   s    t | ƒ}ddlm} ||ƒ |S )zÐ
    Configure the twisted mainloop to be run inside the gtk mainloop.

    @param useGtk: should glib rather than GTK+ event loop be
        used (this will be slightly faster but does not support GUI).
    r   ©ÚinstallReactor)r   Útwisted.internet.mainr&   ©r	   Úreactorr&   r   r   r   Úinstall]   s   r*   c                 C   s   t ƒ }ddlm} ||ƒ |S )zK
    Configure the twisted mainloop to be run inside the gtk mainloop.
    r   r%   )r#   r'   r&   r(   r   r   r   ÚportableInstallk   s   r+   Úposixr   )r   ÚsysÚtwisted.internetr   Útwisted.pythonr   ÚhasattrÚpygtkÚrequireÚImportErrorÚAttributeErrorr   r   r   r   r$   r#   r*   r+   ÚplatformÚgetTypeÚ__all__r   r   r   r   Ú<module>   s.   

€ÿ



