ó
|Nc           @   s}   d  Z  d d l Td Z d Z d Z d Z d	 Z d
 Z d d d „  ƒ  YZ d d d „  ƒ  YZ	 d „  Z
 e d k ry e
 ƒ  n  d S(   s†   A CallTip window class for Tkinter/IDLE.

After ToolTip.py, which uses ideas gleaned from PySol
Used by the CallTips IDLE extension.

iÿÿÿÿ(   t   *s   <<calltipwindow-hide>>s   <Key-Escape>s
   <FocusOut>s   <<calltipwindow-checkhide>>s   <KeyRelease>s   <ButtonRelease>id   t   calltipwindowregion_rightt   CallTipc           B   sJ   e  Z d  „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z	 RS(   c         C   sF   | |  _  d  |  _ |  _ d  |  _ |  _ d  |  _ d  |  _ |  _ d  S(   N(	   t   widgett   Nonet	   tipwindowt   labelt	   parenlinet   parencolt   lastlinet   hideidt   checkhideid(   t   selfR   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt   __init__   s
    		c         C   s(  t  |  j j d ƒ j d ƒ d ƒ } | |  j k r8 d S| |  _ |  j j d ƒ | |  j k r… |  j j d |  j |  j f ƒ } n |  j j d | ƒ } | sÐ t	 |  j j d ƒ ƒ } d | d <d | d <n  | d |  j j
 ƒ  d } | d | d	 |  j j ƒ  } |  j j d
 | | f ƒ d S(   s;   Check if needs to reposition the window, and if so - do it.t   insertt   .i    Ns   %d.%ds   %d.0i   i   i   s   +%d+%d(   t   intR   t   indext   splitR	   t   seeR   t   bboxR   t   listt   winfo_rootxt   winfo_rootyR   t   wm_geometry(   R   t   curlinet   boxt   xt   y(    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt   position_window   s     %	
c   	      C   s  t  | ƒ d k rt | j ƒ  } xA t | ƒ D]3 \ } } t  | ƒ d k r+ | d  d | | <q+ q+ Wd j | ƒ } n  | |  _ |  j s |  j r” d S|  j j t | ƒ t	 t
 |  j j | ƒ j d ƒ ƒ \ |  _ |  _ t |  j ƒ |  _ } |  j ƒ  | j d ƒ y# | j j d d	 | j d
 d ƒ Wn t k
 r:n Xt | d |  j d t d d d t d d d |  j d ƒ|  _ |  j j ƒ  |  j j t |  j ƒ |  _ x! t D] } |  j j  t | ƒ q§W|  j j! t" |  j ƒ |  j j t# |  j$ ƒ |  _% x! t& D] } |  j j  t# | ƒ qüWd S(   sM   Show the calltip, bind events which will close it and reposition it.
        iO   iK   s    ...s   
NR   i   s!   ::tk::unsupported::MacWindowStylet   stylet   helpt   noActivatest   textt   justifyt
   backgrounds   #ffffe0t   relieft   borderwidtht   font('   t   lent
   splitlinest	   enumeratet   joinR!   R   R   t   mark_sett
   MARK_RIGHTt   mapR   R   R   R   R   t   ToplevelR   t   wm_overrideredirectt   tkt   callt   _wt   TclErrort   Labelt   LEFTt   SOLIDR   t   packt   bindt   CHECKHIDE_VIRTUAL_EVENT_NAMEt   checkhide_eventR   t   CHECKHIDE_SEQUENCESt	   event_addt   aftert   CHECKHIDE_TIMEt   HIDE_VIRTUAL_EVENT_NAMEt
   hide_eventR
   t   HIDE_SEQUENCES(	   R   R!   t	   parenleftt
   parenrightt	   textlinest   it   linet   twt   seq(    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt   showtip/   sB    	-
c         C   s­   |  j  s d  St t |  j j d ƒ j d ƒ ƒ \ } } | |  j k  s| | |  j k rd | |  j k s| |  j j d d t	 ƒ r‰ |  j
 ƒ  n  |  j ƒ  |  j j t |  j ƒ d  S(   NR   R   t   >(   R   R-   R   R   R   R   R   R   t   compareR,   t   hidetipR   R=   R>   R:   (   R   t   eventR   t   curcol(    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyR:   \   s    	*
c         C   s   |  j  s d  S|  j ƒ  d  S(   N(   R   RL   (   R   RM   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyR@   k   s    	c         C   sê   |  j  s d  Sx! t D] } |  j j t | ƒ q W|  j j t |  j ƒ d  |  _ x! t D] } |  j j t	 | ƒ qW W|  j j t	 |  j
 ƒ d  |  _
 |  j j ƒ  d  |  _ |  j  j ƒ  d  |  _  |  j j t ƒ d  |  _ |  _ |  _ d  S(   N(   R   R;   R   t   event_deleteR9   t   unbindR   R   RA   R?   R
   R   t   destroyt
   mark_unsetR,   R   R   R	   (   R   RH   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyRL   q   s     					c         C   s   t  |  j ƒ S(   N(   t   boolR   (   R   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt	   is_active†   s    N(
   t   __name__t
   __module__R   R   RI   R   R:   R@   RL   RT   (    (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyR      s   			-		t	   containerc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s¿   t  ƒ  } t | ƒ } |  _ | j d t d t d d ƒ | j d d ƒ | j ƒ  t | ƒ |  _	 | j
 d d ƒ | j
 d	 d
 ƒ | j d |  j ƒ | j d	 |  j ƒ | j ƒ  | j ƒ  d  S(   Nt   sidet   fillt   expandi   R   s   string.splits   <<calltip-show>>t   (s   <<calltip-hide>>t   )(   t   Tkt   TextR!   R7   R5   t   BOTHR   t   updateR   t   calltipR<   R8   t   calltip_showt   calltip_hidet	   focus_sett   mainloop(   R   t   rootR!   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyR      s    	

c         C   s   |  j  j d ƒ d  S(   Ns   Hello world(   Ra   RI   (   R   RM   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyRb       s    c         C   s   |  j  j ƒ  d  S(   N(   Ra   RL   (   R   RM   (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyRc   £   s    (   RU   RV   R   Rb   Rc   (    (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyRW      s   		c          C   s   t  ƒ  }  d  S(   N(   RW   (   t   c(    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt   main¦   s    t   __main__N(   s   <Key-Escape>s
   <FocusOut>(   s   <KeyRelease>s   <ButtonRelease>(    (    (   t   __doc__t   TkinterR?   RA   R9   R;   R>   R,   R   RW   Rh   RU   (    (    (    s*   C:\RCS\Python\lib\idlelib\CallTipWindow.pyt   <module>   s   
~	