Your IP : 216.73.216.213


Current Path : /opt/alt/python33/lib64/python3.3/Tools/pynche/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/Tools/pynche/__pycache__/StripViewer.cpython-33.pyo

�
��fu<c@s�dZddlTddlZdZdZdZdZdZd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZGdd�d�ZGdd�de�ZGdd�d�ZGdd�d�ZdS(uzStrip 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(u*Nu�proc setcolor {canv colors} {
    set i 1
    foreach c $colors {
        $canv itemconfigure $i -fill $c -outline $c
        incr i
    }
}
iiiu cCsXd|d}d}g}x7|dkrS|jt|��||}|d}qW|S(Ng�o@igi(uappenduint(unumchipsustepustartuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant4s
uconstantcCs)t|�}tt|g|||��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_red_generator?suconstant_red_generatorcCs)t|�}tt||g||��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_green_generatorDsuconstant_green_generatorcCs)t|�}tt|||g|��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_blue_generatorIsuconstant_blue_generatorcCs0t|�}tt||g||g|��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_cyan_generatorNsuconstant_cyan_generatorcCs0t|�}tt|g|||g|��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_magenta_generatorSsuconstant_magenta_generatorcCs0t|�}tt|g||g||��S(N(uconstantulistuzip(unumchipsuredugreenublueuseq((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuconstant_yellow_generatorXsuconstant_yellow_generatorcBsn|EeZdZdZdZdZdZdZdd�Zdd	�Z	d
d�Z
dd
�Zdd�ZdS(u	LeftArrowiii
iu	leftarrowcCs5||_|j|�\|_|_|j|�dS(N(u_canvasu_createu_LeftArrow__arrowu_LeftArrow__textumove_to(uselfucanvasux((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu__init__es	uLeftArrow.__init__c
Cs�|jj||j|j||j||j|jddddd|j�}|jj||jd|j|jd|jdd�}||fS(	Nuarrowufirstuwidthg@utagsi
utextu128(u_canvasucreate_lineu_ARROWHEIGHTu_YOFFSETu_ARROWWIDTHu_TAGucreate_textu_TEXTYOFFSET(uselfuxuarrowutext((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu_createjs					uLeftArrow._createcCs#t|jj|j��}|dS(Ni(ulistu_canvasucoordsu_TAG(uselfucoords((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu_xysuLeftArrow._xcCs-||j�}|jj|j|d�dS(Ni(u_xu_canvasumoveu_TAG(uselfuxudeltax((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyumove_to~suLeftArrow.move_tocCs|jj|jd|�dS(Nutext(u_canvasu
itemconfigureu_LeftArrow__text(uselfutext((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuset_text�suLeftArrow.set_textN(u	leftarrow(
u__name__u
__module__u__qualname__u_ARROWWIDTHu_ARROWHEIGHTu_YOFFSETu_TEXTYOFFSETu_TAGu__init__u_createu_xumove_touset_text(u
__locals__((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu	LeftArrow^su	LeftArrowcBs2|EeZdZdZdd�Zdd�ZdS(u
RightArrowu
rightarrowc
Cs�|jj||j||j|j||j|j|jddddd|j�}|jj||jd|j|jdtdd	d|j�}||fS(
Nuarrowulastuwidthg@utagsiujustifyutextu128(	u_canvasucreate_lineu_YOFFSETu_ARROWWIDTHu_ARROWHEIGHTu_TAGucreate_textu_TEXTYOFFSETuRIGHT(uselfuxuarrowutext((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu_create�s			uRightArrow._createcCs*t|jj|j��}|d|jS(Ni(ulistu_canvasucoordsu_TAGu_ARROWWIDTH(uselfucoords((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu_x�su
RightArrow._xN(u
rightarrow(u__name__u
__module__u__qualname__u_TAGu_createu_x(u
__locals__((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu
RightArrow�su
RightArrowcBs�|EeZdZdZdZdZdeeeddddddd�	Zdd�Zdd	d
�Z	dd�Z
d
d�Zdd�ZdS(uStripWidgeti2i
i(ucCs�||_||_||_|	|_|
|_d|_||_||d}|d}t|d|d|�}
|_	|
j
�|
jd|j�|
jd|j�|
jd|j�|
j
jt�g}|_d}d}d}xht|j�D]W}d
}|
j||||||d|d|d
|�||d}|j|�q�W|
jd||dd|dt�|_|jd�}t|
|�|_|jt|�d�}t|
|�|_dS(Nii+uwidthuheightu<ButtonPress-1>u<ButtonRelease-1>u<B1-Motion>iuchipugreyufilluoutlineutagsiiutextuanchori(uchip(u_StripWidget__generatoru_StripWidget__axisu_StripWidget__numchipsu_StripWidget__uwdu_StripWidget__hexpuNoneu_StripWidget__lastchipu_StripWidget__sbuCanvasu_StripWidget__canvasupackubindu_StripWidget__select_chiputkuevaluTCLPROCu_StripWidget__chipsurangeucreate_rectangleuappenducreate_textuWu_StripWidget__labelu_StripWidget__arrow_xu	LeftArrowu_StripWidget__leftarrowulenu
RightArrowu_StripWidget__rightarrow(uselfuswitchboardumasteru	chipwidthu
chipheightunumchipsu	generatoruaxisulabeluuwdvaruhexvarucanvaswidthucanvasheightucanvasuchipsuxuyutagsucucoloruchipx((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu__init__�sJ							
	

uStripWidget.__init__cCs4|jj|d�}|\}}}}||dS(Nig@(u_StripWidget__canvasucoords(uselfuchipnumucoordsux0uy0ux1uy1((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu	__arrow_x�suStripWidget.__arrow_xcCs�|j}|j}|j}|j||||�}|r�d|dkoW|jknr�|j|dd}tj|�\}}}	t|j	�}
|
t
ks�|jj�r�|j
j|||	�q�|j|d|||	f�ndS(Nii(uxuyu_StripWidget__canvasufind_overlappingu_StripWidget__numchipsu_StripWidget__chipsuColorDBurrggbb_to_tripletuintutypeuBTNUPu_StripWidget__uwdugetu_StripWidget__sbuupdate_viewsu_StripWidget__trackarrow(uselfueventuxuyucanvasuchipucoloruredugreenublueuetype((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu
__select_chip�s			)uStripWidget.__select_chipcCsP|jdk	rC|jj|jd�}|jj|jd|�n||_||j}|jj�rwt|�}nt	|�}|dkr�|j
j|�|j
j|j
|d��|jjd�n=|jj|�|jj|j
|d��|j
jd	�tj|�}|dkr0d}nd}|jj|d|�dS(
Nufilluoutlinei�iiduwhiteublacki����i����(u_StripWidget__lastchipuNoneu_StripWidget__canvasuitemcgetu
itemconfigureu_StripWidget__axisu_StripWidget__hexpugetuhexurepru_StripWidget__leftarrowuset_textumove_tou_StripWidget__arrow_xu_StripWidget__rightarrowuColorDButriplet_to_brightness(uselfuchipurgbtupleucoloru	coloraxisutextu
brightnessuoutline((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu__trackarrows(	
	uStripWidget.__trackarrowcCs�d}d}g}|_|jj}x�|j|j|||�D]h}tj|�}	|j|	�|\}
}}|
|kr�||kr�||kr�|}n|d}qAWtj	|�}
|j
d|jj|
f�|j||||f�dS(Niiusetcolor %s {%s}(
u_StripWidget__chipsu_StripWidget__canvasutku_StripWidget__generatoru_StripWidget__numchipsuColorDButriplet_to_rrggbbuappenduSPACEujoinuevalu_wu_StripWidget__trackarrow(uselfuredugreenublueuiuchipuchipsutkuturrggbbutredutgreenutblueucolors((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuupdate_yourself#s
"
$	uStripWidget.update_yourselfcCs&|jj|jd|�||_dS(Nutext(u_StripWidget__canvasu
itemconfigureu_StripWidget__labelu_StripWidget__generator(uselfulabelu	generator((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuset7suStripWidget.setN(
u__name__u
__module__u__qualname__u_CHIPHEIGHTu
_CHIPWIDTHu	_NUMCHIPSuNoneu__init__u_StripWidget__arrow_xu_StripWidget__select_chipu_StripWidget__trackarrowuupdate_yourselfuset(u
__locals__((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuStripWidget�s";"uStripWidgetcBsh|EeZdZd
dd�Zdd�Zd
dd�Zd
dd�Zd
d	d
�Zdd�Z	d
S(uStripViewerc
Cs�||_|j�}t|dtdd�}|jddddddd	d
�t�}|_|j|jdd��t�}|_	|j|jdd��t|�}|j
d
tdt�t
||dtddddd|d|�|_t
||dtddddd|d|�|_t
||dtddddd|d|�|_t|�}|j
d
tdt�|jddd�|jddd�d}	t|ddd|j�}
|
jddddddd	td|	�t|ddd |�}|jddddd	t�t|dd!d |d|j�}|jddddd	t�t|dd"d|j�}
|
jddddddd	td|	�dS(#Nureliefuborderwidthiurowucolumniu
columnspaniustickyuNSEWuUPWHILEDRAGuHEXSTRIPuexpandufillu	generatoruaxisulabeluRed VariationsuuwdvaruhexvaruGreen VariationsuBlue VariationsuweightiiutextuBlackucommandurowspanupadxuUpdate while dragginguvariableuHexadecimaluWhite(u_StripViewer__sbuoptiondbuFrameuRAISEDugridu
BooleanVaru_StripViewer__uwdvarusetugetu_StripViewer__hexpvarupackuYESuBOTHuStripWidgetuconstant_cyan_generatoru_StripViewer__redsuconstant_magenta_generatoru_StripViewer__greensuconstant_yellow_generatoru_StripViewer__bluesucolumnconfigureuButtonu_StripViewer__toblackuWuCheckbuttonu_StripViewer__togglehexu_StripViewer__towhiteuE(uselfuswitchboardumasteruoptiondbuframeuuwduhexpuframe1uframe2upadxublackbtnuuwdbtnuhexbtnuwhitebtn((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu__init__=s^	"	(				uStripViewer.__init__cCsF|jj|||�|jj|||�|jj|||�dS(N(u_StripViewer__redsuupdate_yourselfu_StripViewer__greensu_StripViewer__blues(uselfuredugreenublue((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuupdate_yourself�suStripViewer.update_yourselfcCs/|jj�\}}}|j|||�dS(N(u_StripViewer__sbucurrent_rgbuupdate_yourself(uselfueventuredugreenublue((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu__togglehex�suStripViewer.__togglehexcCs|jjddd�dS(Ni(u_StripViewer__sbuupdate_views(uselfuevent((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu	__toblack�suStripViewer.__toblackcCs|jjddd�dS(Ni�(u_StripViewer__sbuupdate_views(uselfuevent((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu	__towhite�suStripViewer.__towhitecCs*|jj�|d<|jj�|d<dS(NuUPWHILEDRAGuHEXSTRIP(u_StripViewer__uwdvarugetu_StripViewer__hexpvar(uselfuoptiondb((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyusave_options�suStripViewer.save_optionsN(
u__name__u
__module__u__qualname__uNoneu__init__uupdate_yourselfu_StripViewer__togglehexu_StripViewer__toblacku_StripViewer__towhiteusave_options(u
__locals__((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyuStripViewer<sOuStripViewer(u__doc__utkinteruColorDBuTCLPROCuBTNDOWNuBTNUPuBTNDRAGuSPACEuconstantuconstant_red_generatoruconstant_green_generatoruconstant_blue_generatoruconstant_cyan_generatoruconstant_magenta_generatoruconstant_yellow_generatoru	LeftArrowu
RightArrowuStripWidgetuStripViewer(((u=/opt/alt/python33/lib64/python3.3/Tools/pynche/StripViewer.pyu<module>s$

(�