ó
[łXMc           @   s   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d a	 d d d  Z
 d   Z d   Z d	 d
 d  Z d d g Z d S(   sâ  
This module integrates Tkinter with twisted.internet's mainloop.

Maintainer: Itamar Shtull-Trauring

To use, do::

    | tksupport.install(rootWidget)

and then run your reactor as usual - do *not* call Tk's mainloop(),
use Twisted's regular mechanism for running the event loop.

Likewise, to stop your program you will need to stop Twisted's
event loop. For example, if you want closing your root widget to
stop Twisted::

    | root.protocol('WM_DELETE_WINDOW', reactor.stop)

i˙˙˙˙N(   t   log(   t   taski
   c         C   s1   t    t j |  j  a t j | d t  d S(   s/   Install a Tkinter.Tk() object into the reactor.g     @@N(   t   installTkFunctionsR   t   LoopingCallt   updatet   _taskt   startt   False(   t   widgett   mst   reactor(    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/tksupport.pyt   install#   s    c           C   s   t  j   d a  d S(   sd   Remove the root Tk widget from the reactor.

    Call this before destroy()ing the root widget.
    N(   R   t   stopt   None(    (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/tksupport.pyt	   uninstall*   s    
c          C   s   d d  l  }  t |  j j _ d  S(   Ni˙˙˙˙(   t   twisted.python.utilt   getPasswordt   pythont   util(   t   twisted(    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/tksupport.pyR   4   s    t    i    c         C   sd   x] t  j d |  d d } | s% | St  j d d d d } | | k rM | St j d d  q d  S(   Ns   Password Dialogt   showt   *s   Confirm Passwords   Password Mismatchs&   Passwords did not match, starting over(   t   tkSimpleDialogt	   askstringt   tkMessageBoxt	   showerror(   t   promptt   confirmt   try1t   try2(    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/tksupport.pyR   9   s    R   R   (   t   __doc__t   TkinterR   R   t   twisted.pythonR    t   twisted.internetR   R   R   R   R   R   R   t   __all__(    (    (    s>   /usr/lib/python2.7/dist-packages/twisted/internet/tksupport.pyt   <module>   s   $	
	