???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
¿œ^c           @   s'   d  Z  d d l Td d d „  ƒ  YZ d S(   s  TypeinViewer class.

The TypeinViewer is what you see at the lower right of the main Pynche
widget.  It contains three text entry fields, one each for red, green, blue.
Input into these windows is highly constrained; it only allows you to enter
values that are legal for a color axis.  This usually means 0-255 for decimal
input and 0x0 - 0xff for hex input.

You can toggle whether you want to view and input the values in either decimal
or hex by clicking on Hexadecimal.  By clicking on Update while typing, the
color selection will be made on every change to the text field.  Otherwise,
you must hit Return or Tab to select the color.
iÿÿÿÿ(   t   *t   TypeinViewerc           B   s_   e  Z d d  „ Z d d „ Z d d „ Z d d „ Z d d „ Z d „  Z d „  Z	 d „  Z
 RS(	   c      	   C   s"  | |  _  | j ƒ  } t ƒ  |  _ |  j j | j d d ƒ ƒ t ƒ  |  _ |  j j | j d d ƒ ƒ t | d t d d ƒ|  _	 |  j	 j
 d d d	 d d
 d ƒ t |  j	 d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ t |  j	 ƒ } | j
 d d d	 d ƒ t | d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ d |  j d <t | d d ƒ|  _ |  j j
 d d d	 d ƒ |  j j |  j j ƒ  d ƒ |  j j d d |  j ƒ |  j j d d |  j ƒ t |  j	 d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ t |  j	 ƒ } | j
 d d d	 d ƒ t | d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ d |  j d <t | d d ƒ|  _ |  j j
 d d d	 d ƒ |  j j |  j j ƒ  d ƒ t |  j	 d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ t |  j	 ƒ } | j
 d d d	 d ƒ t | d d ƒ|  _ |  j j
 d d d	 d d
 t ƒ d |  j d <t | d d ƒ|  _ |  j j
 d d d	 d ƒ |  j j |  j j ƒ  d  ƒ t |  j	 d d d |  j ƒ|  _ |  j j
 d d d	 d d d d
 t ƒ t |  j	 d d d |  j d |  j ƒ|  _ |  j j
 d d d	 d d d d
 t ƒ d  S(!   Nt   HEXTYPEi    t   UPWHILETYPEt   relieft   borderwidthi   t   rowi   t   columnt   stickyt   NSEWt   texts   Red:t   0xt   couriert   fontt   widtht	   Normalizet   Updates   <Key>s   Green:s   Blue:i   s   Update while typingt   variablet
   columnspant   Hexadecimalt   commandi   (   R   R   (   R   R   (   R   R   (    t   _TypeinViewer__sbt   optiondbt
   BooleanVart   _TypeinViewer__hexpt   sett   gett   _TypeinViewer__uwtypingt   Framet   RAISEDt   _TypeinViewer__framet   gridt   Labelt   _TypeinViewer__xlt   Et   _TypeinViewer__xoxt   Entryt   _TypeinViewer__xt   bindtagst
   bind_classt   _TypeinViewer__normalizet   _TypeinViewer__maybeupdatet   _TypeinViewer__ylt   _TypeinViewer__yoxt   _TypeinViewer__yt   _TypeinViewer__zlt   _TypeinViewer__zoxt   _TypeinViewer__zt   Checkbuttont   _TypeinViewer__uwtt   Wt   _TypeinViewer__togglehext   _TypeinViewer__hex(   t   selft   switchboardt   masterR   t   subframe(    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   __init__   sb    	%	c         C   st   |  j  j ƒ  \ } } } |  j j ƒ  r0 d } n d } | |  j d <| |  j d <| |  j d <|  j | | | ƒ d  S(   NR   s     R
   (   R   t   current_rgbR   R   R#   R+   R.   t   update_yourself(   R5   t   eventt   redt   greent   bluet   label(    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   __togglehexN   s    	c         C   so  | j  } | j ƒ  } | j t ƒ } | rV | d d k rV |  j j ƒ  rV d | } n  y1 |  j j ƒ  rz t | d ƒ } n t | ƒ } Wn t k
 r  d  } n X| d  k r° nŽ | d k  sÈ | d k r| j t ƒ } | j r| | d  | | } | d 8} n  | j	 ƒ  n. |  j j ƒ  r2t
 | ƒ d } n t | ƒ } | j d t ƒ | j d | ƒ | j | ƒ d  S(   Ni    t   xXt   0i   iÿ   i   i   (   t   widgetR   t   indext   INSERTR   t   intt
   ValueErrort   Nonet   chart   bellt   hext   deletet   ENDt   insertt   icursor(   R5   R<   t   ewt   contentsRP   t   vt   i(    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   __normalizeY   s2    	%
	c         C   s2   |  j  j ƒ  s | j d k r. |  j | ƒ n  d  S(   Nt   Returnt   Tab(   RV   RW   (   R   R   t   keysymt   _TypeinViewer__update(   R5   R<   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   __maybeupdatez   s    c   
      C   s«   |  j  j ƒ  p d } |  j j ƒ  p' d } |  j j ƒ  p< d } |  j j ƒ  rW d } n d } g  | | | f D] } t | | ƒ ^ qm \ } } }	 |  j j | | |	 ƒ d  S(   NRC   i   i
   (   R%   R   R,   R/   R   RG   R   t   update_views(
   R5   R<   t   redstrt   greenstrt   bluestrt   baset   xR=   R>   R?   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   __update~   s    	4c         C   s0  |  j  j ƒ  rG g  | | | f D] } t | ƒ d ^ q \ } } } n | | | } } } |  j |  j |  j } } }	 | j t ƒ }
 | j t ƒ } |	 j t ƒ } | j d t	 ƒ | j d t	 ƒ |	 j d t	 ƒ | j
 d | ƒ | j
 d | ƒ |	 j
 d | ƒ | j |
 ƒ | j | ƒ |	 j | ƒ d  S(   Ni   i    (   R   R   RL   R%   R,   R/   RE   RF   RM   RN   RO   RP   (   R5   R=   R>   R?   R`   t   sredt   sgreent   sbluet   yt   zt   xicursort   yicursort   zicursor(    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyR;   ‰   s     8c         C   s   |  j  S(   N(   R   (   R5   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   hexp_varœ   s    c         C   s*   |  j  j ƒ  | d <|  j j ƒ  | d <d  S(   NR   R   (   R   R   R   (   R5   R   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   save_optionsŸ   s    N(   t   __name__t
   __module__RI   R9   R3   R(   R)   RY   R;   Rj   Rk   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyR      s   :!		N(    (   t   __doc__t   TkinterR   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/TypeinViewer.pyt   <module>   s   
