Viewing File: /usr/lib64/python2.7/site-packages/pynche/StripViewer.pyc

ó
f
Qc@sÌdZddlTddlZdZdZdZdZdZd	„Zd
„Z	d„Z
d„Zd
„Zd„Z
d„Zddd„ƒYZdefd„ƒYZddd„ƒYZddd„ƒYZdS(szStrip 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*Nsproc setcolor {canv colors} {
    set i 1
    foreach c $colors {
        $canv itemconfigure $i -fill $c -outline $c
        incr i
    }
}
iiit cCsXd|d}d}g}x7|dkrS|jt|ƒƒ||}|d}qW|S(Ngào@igi(tappendtint(tnumchipststeptstarttseq((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant4s
cCs&t|ƒ}td|g|||ƒS(N(RtmaptNone(RtredtgreentblueR((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_red_generator?scCs&t|ƒ}td||g||ƒS(N(RR	R
(RRRR
R((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_green_generatorDscCs&t|ƒ}td|||g|ƒS(N(RR	R
(RRRR
R((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_blue_generatorIscCs-t|ƒ}td||g||g|ƒS(N(RR	R
(RRRR
R((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_cyan_generatorNscCs-t|ƒ}td|g|||g|ƒS(N(RR	R
(RRRR
R((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_magenta_generatorSscCs-t|ƒ}td|g||g||ƒS(N(RR	R
(RRRR
R((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytconstant_yellow_generatorXst	LeftArrowcBsSeZdZdZdZdZd
Zd„Zd„Zd„Z	d„Z
d	„ZRS(iii
it	leftarrowcCs5||_|j|ƒ\|_|_|j|ƒdS(N(t_canvast_createt_LeftArrow__arrowt_LeftArrow__texttmove_to(tselftcanvastx((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt__init__es	c
Cs|jj||j|j||j||j|jddddd|jƒ}|jj||jd|j|jd|jddƒ}||fS(	Ntarrowtfirsttwidthg@ttagsi
ttextt128(Rtcreate_linet_ARROWHEIGHTt_YOFFSETt_ARROWWIDTHt_TAGtcreate_textt_TEXTYOFFSET(RRRR#((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyRjs					cCs)|jj|jƒ}|s!t‚|dS(Ni(RtcoordsR)tAssertionError(RR,((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt_xyscCs-||jƒ}|jj|j|dƒdS(Ni(R.RtmoveR)(RRtdeltax((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR~scCs|jj|jd|ƒdS(NR#(Rt
itemconfigureR(RR#((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytset_text‚s(R(t__name__t
__module__R(R&R'R+R)RRR.RR2(((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR^s				t
RightArrowcBs eZdZd„Zd„ZRS(t
rightarrowc
Cs|jj||j||j|j||j|j|jddddd|jƒ}|jj||jd|j|jdtdd	d|jƒ}||fS(
NRtlastR!g@R"itjustifyR#R$(	RR%R'R(R&R)R*R+tRIGHT(RRRR#((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR‰s			cCs0|jj|jƒ}|s!t‚|d|jS(Ni(RR,R)R-R((RR,((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR.™s(R6(R3R4R)RR.(((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR5†s	tStripWidgetc
BsneZdZdZdZd
eeed
d
dd
d
d„	Zd„Zd
d„Zd„Z	d„Z
d	„ZRS(i2i
i(tcCsá||_||_||_|jdks0t‚|	|_|
|_d|_||_||d}|d}t	|d|d|ƒ}
|_
|
jƒ|
jd|j
ƒ|
jd|j
ƒ|
jd	|j
ƒ|
jjtƒ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(Niiii+R!theights<ButtonPress-1>s<ButtonRelease-1>s<B1-Motion>itchiptgreytfilltoutlineR"iiR#tanchor(iii(schip(t_StripWidget__generatort_StripWidget__axist_StripWidget__numchipsR-t_StripWidget__uwdt_StripWidget__hexpR
t_StripWidget__lastchipt_StripWidget__sbtCanvast_StripWidget__canvastpacktbindt_StripWidget__select_chipttktevaltTCLPROCt_StripWidget__chipstrangetcreate_rectangleRR*tWt_StripWidget__labelt_StripWidget__arrow_xRt_StripWidget__leftarrowtlenR5t_StripWidget__rightarrow(Rtswitchboardtmastert	chipwidtht
chipheightRt	generatortaxistlabeltuwdvarthexvartcanvaswidthtcanvasheightRtchipsRtyR"tctcolortchipx((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR¥sL							
	

cCs@|jj|dƒ}|s"t‚|\}}}}||dS(Nig@(RJR,R-(RtchipnumR,tx0ty0tx1ty1((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	__arrow_xéscCsð|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(RRfRJtfind_overlappingRDRQtColorDBtrrggbb_to_tripletRttypetBTNUPREtgetRHtupdate_viewst_StripWidget__trackarrow(RteventRRfRR=RhRRR
tetype((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt
__select_chipñs			)cCsP|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(NR?R@i€iiœÿÿÿtwhitetblack(RGR
RJtitemcgetR1RCRFRuthextreprRWR2RRVRYRqttriplet_to_brightness(RR=trgbtupleRht	coloraxisR#t
brightnessR@((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt__trackarrows(	
	cCs|jst‚d}d}g}|_|jj}x…|j|j|||ƒD]h}tj|ƒ}	|j|	ƒ|\}
}}|
|kr®||kr®||kr®|}n|d}qPWt	j
|ƒ}
|jd|jj|
fƒ|j
||||fƒdS(Niissetcolor %s {%s}(RBR-RQRJRNRDRqttriplet_to_rrggbbRtSPACEtjoinROt_wRw(RRRR
tiR=ReRNtttrrggbbttredttgreenttbluetcolors((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytupdate_yourself#s
"
$	cCs&|jj|jd|ƒ||_dS(NR#(RJR1RURB(RR`R^((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytset7sN(R3R4t_CHIPHEIGHTt
_CHIPWIDTHt	_NUMCHIPSR
RRVRMRwRR‘(((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR: s";		"	tStripViewercBsJeZdd„Zd„Zdd„Zdd„Zdd„Zd„ZRS(c
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(#Ntrelieftborderwidthitrowtcolumnit
columnspanitstickytNSEWtUPWHILEDRAGtHEXSTRIPtexpandR?R^R_R`sRed VariationsRaRbsGreen VariationssBlue VariationstweightiiR#tBlacktcommandtrowspantpadxsUpdate while draggingtvariabletHexadecimaltWhite(t_StripViewer__sbtoptiondbtFrametRAISEDtgridt
BooleanVart_StripViewer__uwdvarR‘Rut_StripViewer__hexpvarRKtYEStBOTHR:Rt_StripViewer__redsRt_StripViewer__greensRt_StripViewer__bluestcolumnconfiguretButtont_StripViewer__toblackRTtCheckbuttont_StripViewer__togglehext_StripViewer__towhitetE(RRZR[R©tframetuwdthexptframe1tframe2R¤tblackbtntuwdbtnthexbtntwhitebtn((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR=s^	"	(				cCsF|jj|||ƒ|jj|||ƒ|jj|||ƒdS(N(R²RR³R´(RRRR
((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyRŒscCs/|jjƒ\}}}|j|||ƒdS(N(R¨tcurrent_rgbR(RRxRRR
((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt__togglehex‘scCs|jjdddƒdS(Ni(R¨Rv(RRx((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	__toblack©scCs|jjdddƒdS(Niÿ(R¨Rv(RRx((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt	__towhite¬scCs*|jjƒ|d<|jjƒ|d<dS(NRRž(R®RuR¯(RR©((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pytsave_options¯sN(	R3R4R
RRR¹R·RºRÉ(((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyR•<sO	((((t__doc__tTkinterRqRPtBTNDOWNRttBTNDRAGR†RRRRRRRRR5R:R•(((s8/usr/lib64/python2.7/site-packages/pynche/StripViewer.pyt<module>s$

							(œ
Back to Directory File Manager