U
    ¸~Hj8  ã                	   @   s  d Z ddlmZ ddlmZ ededdddƒƒ dd	lZdd
lmZ ddlm	Z	 z e
edƒsndd	lZe d¡ W n eefk
rˆ   Y nX dd	lZe
edƒs¤edƒ‚e
edƒr¶e ¡  G dd„ dejƒZeZddd„Zddd„Ze	j ¡ dkrôe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.
é    )ÚVersioné   )ÚdeprecatedGnomeReactorZgtk2reactorZTwistedé   é   N)Ú	_glibbase)ÚruntimeÚfrozenz2.0ZIO_HUPz5pygobject 2.x is not installed. Use the `gi` reactor.Úthreads_initc                   @   s   e Zd ZdZddd„ZdS )ÚGtk2Reactorz&
    PyGTK+ 2 event loop reactor.
    Tc                 C   s,   d }|dkrdd l }tjj| t||d� d S )NTr   )ÚuseGtk)Zgtkr   ÚGlibReactorBaseÚ__init__Úgobject)Úselfr   Z_gtk© r   ú@/tmp/pip-unpacked-wheel-ewod1tgb/twisted/internet/gtk2reactor.pyr   J   s    zGtk2Reactor.__init__N)T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   E   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   Zreactorr   r   r   r   ÚinstallX   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   )ÚPortableGtkReactorr   r   r   r   r   r   ÚportableInstallf   s    r   Úposix)T)T)r   Úincrementalr   Z
_deprecater   ÚsysZtwisted.internetr   Ztwisted.pythonr   ÚhasattrZpygtkÚrequireÚImportErrorÚAttributeErrorr   r
   r   r   r   r   r   ÚplatformÚgetTypeÚ__all__r   r   r   r   Ú<module>   s2   




