ó
è¾bc           @   sF   d  Z  d d l Td d d „  ƒ  YZ e d k rB d „  Z e ƒ  n  d S(	   s'   A simple but flexible modal dialog box.iÿÿÿÿ(   t   *t   SimpleDialogc           B   sV   e  Z d  g  d	 d	 d	 d	 d „ Z d d d „ Z d „  Z d „  Z d „  Z d „  Z RS(
   t    c      	   C   s  | r t  | d | ƒ|  _ n t  | ƒ |  _ | rV |  j j | ƒ |  j j | ƒ n  t |  j d | d d ƒ|  _ |  j j d d d t ƒ t |  j ƒ |  _	 |  j	 j ƒ  | |  _
 | |  _ | |  _ |  j j d |  j ƒ x‰ t t | ƒ ƒ D]u } | | }	 t |  j	 d |	 d	 |  | d
 „ ƒ}
 | | k rI|
 j d t d d ƒ n  |
 j d t d t d d ƒ qð W|  j j d |  j ƒ |  j | ƒ d  S(   Nt   class_t   textt   aspecti  t   expandi   t   fills   <Return>t   commandc         S   s   |  j  | ƒ S(   N(   t   done(   t   selft   num(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   <lambda>   R   t   relieft   borderwidthi   t   sidet   WM_DELETE_WINDOW(   t   Toplevelt   roott   titlet   iconnamet   Messaget   messaget   packt   BOTHt   Framet   frameR   t   cancelt   defaultt   bindt   return_eventt   ranget   lent   Buttont   configt   RIDGEt   LEFTt   protocolt   wm_delete_windowt   _set_transient(   R
   t   masterR   t   buttonsR   R   R   R   R   t   st   b(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   __init__	   s.    			
 g      à?g333333Ó?c         C   sh  |  j  } | j ƒ  | j | ƒ | j ƒ  | j ƒ  ri | j ƒ  } | j ƒ  } | j ƒ  } | j ƒ  } n" | j	 ƒ  } | j
 ƒ  } d } } | j ƒ  }	 | j ƒ  }
 | | |	 | } | | |
 | } | |	 | j	 ƒ  k rð | j	 ƒ  |	 } n | d k  rd } n  | |
 | j
 ƒ  k r.| j
 ƒ  |
 } n | d k  rCd } n  | j d | | f ƒ | j ƒ  d  S(   Ni    s   +%d+%d(   R   t   withdrawt	   transientt   update_idletaskst   winfo_ismappedt   winfo_widtht   winfo_heightt   winfo_rootxt   winfo_rootyt   winfo_screenwidtht   winfo_screenheightt   winfo_reqwidtht   winfo_reqheightt   geometryt	   deiconify(   R
   R(   t   relxt   relyt   widgett   m_widtht   m_heightt   m_xt   m_yt   w_widtht   w_heightt   xt   y(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyR'   %   s4    	


		c         C   s;   |  j  j ƒ  |  j  j ƒ  |  j  j ƒ  |  j  j ƒ  |  j S(   N(   R   t   wait_visibilityt   grab_sett   mainloopt   destroyR   (   R
   (    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   goB   s
    c         C   s3   |  j  d  k r |  j j ƒ  n |  j |  j  ƒ d  S(   N(   R   t   NoneR   t   bellR	   (   R
   t   event(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyR   I   s    c         C   s3   |  j  d  k r |  j j ƒ  n |  j |  j  ƒ d  S(   N(   R   RK   R   RL   R	   (   R
   (    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyR&   O   s    c         C   s   | |  _  |  j j ƒ  d  S(   N(   R   R   t   quit(   R
   R   (    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyR	   U   s    	N(	   t   __name__t
   __module__RK   R,   R'   RJ   R   R&   R	   (    (    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyR      s   			t   __main__c          C   sj   t  ƒ  }  |  d „ } t |  d d d | ƒ} | j ƒ  t |  d d d | j ƒ} | j ƒ  | j ƒ  d  S(   Nc         S   sB   t  |  d d d d d d g d d d	 d
 d d ƒ} | j ƒ  GHd  S(   NR   s‘   This is a test dialog.  Would this have been an actual dialog, the buttons below would have been glowing in soft pink light.
Do you believe this?R)   t   Yest   Not   CancelR   i    R   i   R   s   Test Dialog(   R   RJ   (   R   t   d(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   doit^   s    		R   t   TestR   t   Quit(   t   TkR!   R   RN   RH   (   R   RV   t   tt   q(    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   test\   s    	

N(    (   t   __doc__t   TkinterR   RO   R\   (    (    (    s)   /usr/lib/python2.7/lib-tk/SimpleDialog.pyt   <module>   s
   
S	