ó
§xxTc           @   s}   d  Z  d d l Td Z d Z d Z d Z d	 Z d
 Z d d d „  ƒ  YZ d „  Z	 e
 d k ry d d l m Z e 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   sO   | |  _  d  |  _ |  _ d  |  _ |  _ d  |  _ d  |  _ |  _ d  |  _	 d  S(   N(
   t   widgett   Nonet	   tipwindowt   labelt	   parenlinet   parencolt   lastlinet   hideidt   checkhideidt   checkhide_after_id(   t   selfR   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/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(    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyt   position_window   s     %	
c         C   s©  | |  _  |  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 | ƒ q3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.
        NR   i   s!   ::tk::unsupported::MacWindowStylet   stylet   helpt   noActivatest   textt   justifyt
   backgrounds   #ffffe0t   relieft   borderwidtht   font(#   R"   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   twt   seq(    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyt   showtip0   s6    	-
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
 ƒ  nJ |  j ƒ  |  j d  k	 r¸ |  j j |  j ƒ n  |  j j t |  j ƒ |  _ d  S(   NR   R   t   >(   R   R*   R   R   R   R   R   R   t   compareR)   t   hidetipR   R   R   t   after_cancelR:   R;   R7   (   R   t   eventR   t   curcol(    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR7   W   s    	*
c         C   s   |  j  s d  S|  j ƒ  d  S(   N(   R   RF   (   R   RH   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR=   i   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   R8   R   t   event_deleteR6   t   unbindR   R   R>   R<   R
   R   t   destroyt
   mark_unsetR)   R   R   R	   (   R   RB   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyRF   o   s     					c         C   s   t  |  j ƒ S(   N(   t   boolR   (   R   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyt	   is_active„   s    N(
   t   __name__t
   __module__R   R   RC   R   R7   R=   RF   RO   (    (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR      s   			'		c            sŠ   t  ƒ  ‰  ˆ  j d ƒ t t t t j d |  j ƒ  ƒ ƒ ƒ \ } } } } ˆ  j d | | d f ƒ d d ‡  f d †  ƒ  Y} | ƒ  } d  S(   Ns   Test calltipss   [x+]s   +%d+%di–   t	   MyEditWinc              s)   e  Z ‡  f d  †  Z d „  Z d „  Z RS(   c            s¶   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   TextR"   R4   R2   t   BOTHR   t   updateR   t   calltipR9   R5   t   calltip_showt   calltip_hidet	   focus_sett   mainloop(   R   R"   (   t   root(    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR   �   s    

c         S   s   |  j  j d d d ƒ d  S(   Ns   Hello worldR   t   end(   R[   RC   (   R   RH   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR\   ž   s    c         S   s   |  j  j ƒ  d  S(   N(   R[   RF   (   R   RH   (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyR]   ¡   s    (   RP   RQ   R   R\   R]   (    (   R`   (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyRR   Ž   s   	(    (   t   Tkt   titleR   R*   R   t   reR   t   geometry(   t   parentt   widtht   heightR   R   RR   t   editwin(    (   R`   sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyt   _calltip_windowˆ   s    	3t   __main__(   t   runN(   s   <Key-Escape>s
   <FocusOut>(   s   <KeyRelease>s   <ButtonRelease>(    (   t   __doc__t   TkinterR<   R>   R6   R8   R;   R)   R   Rj   RP   t   idlelib.idle_test.htestRl   (    (    (    sA   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/idlelib/CallTipWindow.pyt   <module>   s   
w	