ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     
^c           @   s   d  Z  d d l Td d l Z d Z d Z d Z d Z d Z d	   Z d
   Z	 d   Z
 d   Z d   Z d   Z d   Z d d d     YZ d e f d     YZ d d d     YZ d d d     YZ d S(   sz  Strip viewer and related widgets.

The classes in this file implement the StripViewer shown in the top two thirds
of the main Pynche window.  It consists of three StripWidgets which display
the variations in red, green, and blue respectively of the currently selected
r/g/b color value.

Each StripWidget shows the color variations that are reachable by varying an
axis of the currently selected color.  So for example, if the color is

  (R,G,B)=(127,163,196)

then the Red variations show colors from (0,163,196) to (255,163,196), the
Green variations show colors from (127,0,196) to (127,255,196), and the Blue
variations show colors from (127,163,0) to (127,163,255).

The selected color is always visible in all three StripWidgets, and in fact
each StripWidget highlights the selected color, and has an arrow pointing to
the selected chip, which includes the value along that particular axis.

Clicking on any chip in any StripWidget selects that color, and updates all
arrows and other windows.  By toggling on Update while dragging, Pynche will
select the color under the cursor while you drag it, but be forewarned that
this can be slow.
i(   t   *Ns   proc setcolor {canv colors} {
    set i 1
    foreach c $colors {
        $canv itemconfigure $i -fill $c -outline $c
        incr i
    }
}
i   i   i   t    c         C   sX   d |  d } d } g  } x7 |  d k rS | j  t |   | | } |  d }  q W| S(   Ng     o@i   g        i    (   t   appendt   int(   t   numchipst   stept   startt   seq(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant4   s    
c         C   s&   t  |   } t d  | g |  | |  S(   N(   R   t   mapt   None(   R   t   redt   greent   blueR   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_red_generator?   s    c         C   s&   t  |   } t d  | | g |  |  S(   N(   R   R	   R
   (   R   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_green_generatorD   s    c         C   s&   t  |   } t d  | | | g |   S(   N(   R   R	   R
   (   R   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_blue_generatorI   s    c         C   s-   t  |   } t d  | | g |  | g |   S(   N(   R   R	   R
   (   R   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_cyan_generatorN   s    c         C   s-   t  |   } t d  | g |  | | g |   S(   N(   R   R	   R
   (   R   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_magenta_generatorS   s    c         C   s-   t  |   } t d  | g |  | g |  |  S(   N(   R   R	   R
   (   R   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   constant_yellow_generatorX   s    t	   LeftArrowc           B   sS   e  Z d  Z d Z d Z d Z d
 Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(   i   i   i   i   t	   leftarrowc         C   s5   | |  _  |  j |  \ |  _ |  _ |  j |  d  S(   N(   t   _canvast   _createt   _LeftArrow__arrowt   _LeftArrow__textt   move_to(   t   selft   canvast   x(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   __init__e   s    	c         C   s   |  j  j | |  j |  j | |  j | |  j |  j d d d d d |  j } |  j  j | |  j d |  j |  j d |  j d d } | | f S(	   Nt   arrowt   firstt   widthg      @t   tagsi   t   textt   128(   R   t   create_linet   _ARROWHEIGHTt   _YOFFSETt   _ARROWWIDTHt   _TAGt   create_textt   _TEXTYOFFSET(   R   R   R   R#   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR   j   s    					c         C   s)   |  j  j |  j  } | s! t  | d S(   Ni    (   R   t   coordsR)   t   AssertionError(   R   R,   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   _xy   s    c         C   s-   | |  j    } |  j j |  j | d  d  S(   Ni    (   R.   R   t   moveR)   (   R   R   t   deltax(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR   ~   s    c         C   s   |  j  j |  j d | d  S(   NR#   (   R   t   itemconfigureR   (   R   R#   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   set_text   s    (   R   (   t   __name__t
   __module__R(   R&   R'   R+   R)   R   R   R.   R   R2   (    (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR   ^   s   				t
   RightArrowc           B   s    e  Z d Z d   Z d   Z RS(   t
   rightarrowc         C   s   |  j  j | |  j | |  j |  j | |  j |  j |  j d d d d d |  j } |  j  j | |  j d |  j |  j d t d d	 d |  j } | | f S(
   NR   t   lastR!   g      @R"   i   t   justifyR#   R$   (	   R   R%   R'   R(   R&   R)   R*   R+   t   RIGHT(   R   R   R   R#   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR      s    			c         C   s0   |  j  j |  j  } | s! t  | d |  j S(   Ni    (   R   R,   R)   R-   R(   (   R   R,   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR.      s    (   R6   (   R3   R4   R)   R   R.   (    (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR5      s   	t   StripWidgetc        
   B   sn   e  Z d  Z d Z d Z d
 e e e d
 d
 d d
 d
 d 	 Z d   Z d
 d  Z d   Z	 d   Z
 d	   Z RS(   i2   i
   i(   t    c         C   s  | |  _  | |  _ | |  _ |  j d k s0 t  |	 |  _ |
 |  _ d  |  _ | |  _ | | d } | d } t	 | d | d | } |  _
 | j   | j d |  j  | j d |  j  | j d	 |  j  | j j t  g  } |  _ d } d
 } d } xh t |  j  D]W } d } | j | | | | | | d | d | d | | | d } | j |  qW| j d | | d d | d t |  _ |  j d  } t | |  |  _ |  j t |  d  } t | |  |  _ d  S(   Ni    i   i   i+   R!   t   heights   <ButtonPress-1>s   <ButtonRelease-1>s   <B1-Motion>i   t   chipt   greyt   fillt   outlineR"   i   i   R#   t   anchor(   i    i   i   (   R=   (   t   _StripWidget__generatort   _StripWidget__axist   _StripWidget__numchipsR-   t   _StripWidget__uwdt   _StripWidget__hexpR
   t   _StripWidget__lastchipt   _StripWidget__sbt   Canvast   _StripWidget__canvast   packt   bindt   _StripWidget__select_chipt   tkt   evalt   TCLPROCt   _StripWidget__chipst   ranget   create_rectangleR   R*   t   Wt   _StripWidget__labelt   _StripWidget__arrow_xR   t   _StripWidget__leftarrowt   lenR5   t   _StripWidget__rightarrow(   R   t   switchboardt   mastert	   chipwidtht
   chipheightR   t	   generatort   axist   labelt   uwdvart   hexvart   canvaswidtht   canvasheightR   t   chipsR   t   yR"   t   ct   colort   chipx(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR      sL    							
	
c         C   s@   |  j  j | d  } | s" t  | \ } } } } | | d S(   Ni   g       @(   RJ   R,   R-   (   R   t   chipnumR,   t   x0t   y0t   x1t   y1(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	   __arrow_x   s    c         C   s   | j  } | j } |  j } | j | | | |  } | r d | d k oW |  j k n r |  j | d d } t j |  \ } } }	 t | j	  }
 |
 t
 k s |  j j   r |  j j | | |	  q |  j | d | | |	 f  n  d  S(   Ni   i    (   R   Rf   RJ   t   find_overlappingRD   RQ   t   ColorDBt   rrggbb_to_tripletR   t   typet   BTNUPRE   t   getRH   t   update_viewst   _StripWidget__trackarrow(   R   t   eventR   Rf   R   R=   Rh   R   R   R   t   etype(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   __select_chip   s    			)c         C   sP  |  j  d  k	 rC |  j j |  j  d  } |  j j |  j  d | n  | |  _  | |  j } |  j j   rw t |  } n t	 |  } | d k r |  j
 j |  |  j
 j |  j | d   |  j j d  n= |  j j |  |  j j |  j | d   |  j
 j d  t j |  } | d k r0d } n d } |  j j | d | d  S(   NR?   R@   i   i   it   whitet   black(   RG   R
   RJ   t   itemcgetR1   RC   RF   Ru   t   hext   reprRW   R2   R   RV   RY   Rq   t   triplet_to_brightness(   R   R=   t   rgbtupleRh   t	   coloraxisR#   t
   brightnessR@   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   __trackarrow  s(    		c         C   s  |  j  s t  d } d } g  } |  _ |  j j } x |  j  |  j | | |  D]h } t j |  }	 | j |	  | \ }
 } } |
 | k r | | k r | | k r | } n  | d } qP Wt	 j
 |  } | j d |  j j | f  |  j | | | | f  d  S(   Ni   i    s   setcolor %s {%s}(   RB   R-   RQ   RJ   RN   RD   Rq   t   triplet_to_rrggbbR   t   SPACEt   joinRO   t   _wRw   (   R   R   R   R   t   iR=   Re   RN   t   tt   rrggbbt   tredt   tgreent   tbluet   colors(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   update_yourself#  s    "$	c         C   s&   |  j  j |  j d | | |  _ d  S(   NR#   (   RJ   R1   RU   RB   (   R   R`   R^   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   set7  s    N(   R3   R4   t   _CHIPHEIGHTt
   _CHIPWIDTHt	   _NUMCHIPSR
   R   RV   RM   Rw   R   R   (    (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR:      s"   ;		"	t   StripViewerc           B   sJ   e  Z d d   Z d   Z d d  Z d d  Z d d  Z d   Z RS(   c         C   s  | |  _  | j   } t | d t d d } | j d d d d d d d	 d
  t   } |  _ | j | j d d   t   } |  _	 | j | j d d   t |  } | j
 d t d t  t | | d t d d d d d | d | |  _ t | | d t d d d d d | d | |  _ t | | d t d d d d d | d | |  _ t |  } | j
 d t d t  | j d d d | j d d d d }	 t | d d d |  j }
 |
 j d d d d d d d	 t d |	  t | d d d  | } | j d d d d d	 t  t | d d! d  | d |  j } | j d d d d d	 t  t | d d" d |  j } | j d d d d d d d	 t d |	  d  S(#   Nt   relieft   borderwidthi   t   rowt   columni    t
   columnspani   t   stickyt   NSEWt   UPWHILEDRAGt   HEXSTRIPt   expandR?   R^   R_   R`   s   Red VariationsRa   Rb   s   Green Variationss   Blue Variationst   weighti   i   R#   t   Blackt   commandt   rowspant   padxs   Update while draggingt   variablet   Hexadecimalt   White(   t   _StripViewer__sbt   optiondbt   Framet   RAISEDt   gridt
   BooleanVart   _StripViewer__uwdvarR   Ru   t   _StripViewer__hexpvarRK   t   YESt   BOTHR:   R   t   _StripViewer__redsR   t   _StripViewer__greensR   t   _StripViewer__bluest   columnconfiguret   Buttont   _StripViewer__toblackRT   t   Checkbuttont   _StripViewer__togglehext   _StripViewer__towhitet   E(   R   RZ   R[   R   t   framet   uwdt   hexpt   frame1t   frame2R   t   blackbtnt   uwdbtnt   hexbtnt   whitebtn(    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR   =  s^    	"	(				c         C   sF   |  j  j | | |  |  j j | | |  |  j j | | |  d  S(   N(   R   R   R   R   (   R   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR     s    c         C   s/   |  j  j   \ } } } |  j | | |  d  S(   N(   R   t   current_rgbR   (   R   Rx   R   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   __togglehex  s    c         C   s   |  j  j d d d  d  S(   Ni    (   R   Rv   (   R   Rx   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	   __toblack  s    c         C   s   |  j  j d d d  d  S(   Ni   (   R   Rv   (   R   Rx   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	   __towhite  s    c         C   s*   |  j  j   | d <|  j j   | d <d  S(   NR   R   (   R   Ru   R   (   R   R   (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   save_options  s    N(	   R3   R4   R
   R   R   R   R   R   R   (    (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR   <  s   O	(    (    (    (   t   __doc__t   TkinterRq   RP   t   BTNDOWNRt   t   BTNDRAGR   R   R   R   R   R   R   R   R   R5   R:   R   (    (    (    s8   /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt   <module>   s$   
							(