ó
ąZOc           @   sC  d  Z  d d l Z d e j k r0 e d   n  d e j d <y/ e e d  sk d d l Z e j d  n  Wn e e f k
 r n Xd d l	 Z	 e e	 d  rŽ e	 j
   n  d d l m Z d d	 l m Z d
 e j f d     YZ d e j f d     YZ e d  Z e d  Z e j j   d k r6e Z n  d g Z d S(   s>  
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.
i˙˙˙˙Nt   gisz   Introspected and static glib/gtk bindings must not be mixed; can't import gtk2reactor since gi module is already imported.t   frozens   2.0t   threads_init(   t	   _glibbase(   t   runtimet   Gtk2Reactorc           B   sW   e  Z d  Z e j e j Be j BZ e j Z	 e j
 Z e	 e BZ e e BZ e d  Z RS(   s&   
    PyGTK+ 2 event loop reactor.
    c         C   sA   d  } | t k r! d d  l } n  t j j |  t | d | d  S(   Ni˙˙˙˙t   useGtk(   t   Nonet   Truet   gtkR   t   GlibReactorBaset   __init__t   gobject(   t   selfR   t   _gtk(    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyR   @   s    (   t   __name__t
   __module__t   __doc__R   t   IO_HUPt   IO_ERRt   IO_NVALt   _POLL_DISCONNECTEDt   IO_INt   _POLL_INt   IO_OUTt	   _POLL_OUTt   INFLAGSt   OUTFLAGSR   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyR   2   s   		

t   PortableGtkReactorc           B   s   e  Z d  Z e d  Z RS(   sd   
    Reactor that works on Windows.

    Sockets aren't supported by GTK+'s input_add on Win32.
    c         C   sA   d  } | t k r! d d  l } n  t j j |  t | d | d  S(   Ni˙˙˙˙R   (   R   R   R	   R   t   PortableGlibReactorBaseR   R   (   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyR   O   s
    (   R   R   R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyR   I   s   c         C   s*   t  |   } d d l m } | |  | S(   sĐ   
    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).
    i˙˙˙˙(   t   installReactor(   R   t   twisted.internet.mainR   (   R   t   reactorR   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyt   installX   s    
c         C   s'   t    } d d l m } | |  | S(   sK   
    Configure the twisted mainloop to be run inside the gtk mainloop.
    i˙˙˙˙(   R   (   R   R   R   (   R   R    R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyt   portableInstalle   s    	
t   posixR!   (   R   t   syst   modulest   ImportErrorR   t   hasattrt   pygtkt   requiret   AttributeErrorR   R   t   twisted.internetR   t   twisted.pythonR   R
   R   R   R   R   R!   R"   t   platformt   getTypet   __all__(    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/internet/gtk2reactor.pyt   <module>   s.   
	