ó
ąZOc           @   sé   d  Z  d d l Z d e j k r0 e d   n  d d l m Z e j   d d l m Z d d l	 m
 Z
 d e j d <d e j d <d e j d	 <d e j d
 <d e j f d     YZ d e j f d     YZ e d  Z d g Z d S(   sO  
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()

Then use twisted.internet APIs as usual.  The other methods here are not
intended to be called directly.
i˙˙˙˙Nt   gobjects|   Introspected and static glib/gtk bindings must not be mixed; can't import gireactor since pygtk2 module is already imported.(   t   GLib(   t	   _glibbase(   t   runtimet   glibt   giot   gtkt	   GIReactorc           B   sf   e  Z d  Z e j j e j j Be j j BZ e j j	 Z
 e j j Z e
 e BZ e e BZ e d  Z RS(   s3   
    GObject-introspection event loop reactor.
    c         C   sE   d  } | t k r% d d l m } n  t j j |  t | d | d  S(   Ni˙˙˙˙(   t   Gtkt   useGtk(   t   Nonet   Truet   gi.repositoryR   R   t   GlibReactorBaset   __init__R   (   t   selfR	   t   _gtk(    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyR   6   s    (   t   __name__t
   __module__t   __doc__R   t   IOConditiont   HUPt   ERRt   NVALt   _POLL_DISCONNECTEDt   INt   _POLL_INt   OUTt	   _POLL_OUTt   INFLAGSt   OUTFLAGSt   FalseR   (    (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyR   '   s   

t   PortableGIReactorc           B   s   e  Z d  Z e d  Z RS(   s<   
    Portable GObject Introspection event loop reactor.
    c         C   sE   d  } | t k r% d d l m } n  t j j |  t | d | d  S(   Ni˙˙˙˙(   R   R	   (   R
   R   R   R   R   t   PortableGlibReactorBaseR   R   (   R   R	   R   (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyR   C   s
    (   R   R   R   R   R   (    (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyR    ?   s   c         C   sT   t  j j   d k r' t d |   } n t d |   } d d l m } | |  | S(   sÍ   
    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).
    t   posixR	   i˙˙˙˙(   t   installReactor(   R   t   platformt   getTypeR   R    t   twisted.internet.mainR#   (   R	   t   reactorR#   (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyt   installL   s    
R(   (   R   t   syst   modulest   ImportErrorR   R   t   threads_initt   twisted.internetR   t   twisted.pythonR   R
   R   R   R!   R    R   R(   t   __all__(    (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/gireactor.pyt   <module>   s    
