f Qc@s9dZddlTddlZdZdddYZdS(sListViewer class. This class implements an input/output view on the color model. It lists every unique color (e.g. unique r/g/b value) found in the color database. Each color is shown by small swatch and primary color name. Some colors have aliases -- more than one name for the same r/g/b value. These aliases are displayed in the small listbox at the bottom of the screen. Clicking on a color name or swatch selects that color and updates all other windows. When a color is selected in a different viewer, the color list is scrolled to the selected color and it is highlighted. If the selected color is an r/g/b value without a name, no scrolling occurs. You can turn off Update On Click if all you want to see is the alias for a given name, without selecting the color. i(t*NsColor %List Window...t ListViewercBsteZd dZdZd dZd dZd dZd dZd dZ dZ dZ d Z RS( c Cs=||_|j}d|_d|_t|dd}|_|jd|j|j d|j d|j d|j |j d|j |j d|j|j d |jt |}|_|jt|d d d d dddt}|_t||_|jjdtdt|jdtdd|jd|jdf|jjd|df|jt|_|jj|jddt|ddd|jd|j|_ |j jdddtt!|dd|_"|j"jt#|d ddt$|_%|j%jdddtdS( Nitclass_tPynchetWM_DELETE_WINDOWsPynche Color Listsssstwidthitheighti,t borderwidthitrelieftfilltsidetexpandityscrollcommandtsettcommandtyviewt UPONCLICKttextsUpdate on ClicktvariablesAliases:it selectmode(&t_ListViewer__sbtoptiondbtNonet_ListViewer__lastboxt_ListViewer__dontcentertToplevelt_ListViewer__roottprotocoltwithdrawttitleticonnametbindt_ListViewer__quittFramet_ListViewer__frametpacktCanvastSUNKENt_ListViewer__canvast Scrollbart_ListViewer__scrollbartYtRIGHTtBOTHt configuret_ListViewer__populatet BooleanVart_ListViewer__uocR tgett Checkbuttont_ListViewer__toggleupdatet_ListViewer__uocbtntLabelt_ListViewer__alabeltListboxtBROWSEt_ListViewer__aliases(tselft switchboardtmasterRtroottframetcanvas((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyt__init__sD             c Cs|jj}|j}d}d}g}|_x|jD]}tj|j|}|jd|ddd|ddd||j d|ddd|dt }|j |\} } } } |jd |dd | d |dd d d d |df} |j d|j |j| | d |krD| d }n|d7}q>W|ddd}|jdddd|fxB|D]:}|j|\} } }} |j|| | || qWdS(NiiiR ii Rtanchoriitoutlinetttagstallsit scrollregioni(RtcolordbR&t_ListViewer__bboxest unique_namestColorDBttriplet_to_rrggbbt find_bynametcreate_rectanglet create_texttWtbboxRt_ListViewer__onreleasetappendtconfigtcoords(R9RFR>trowtwidesttbboxestnamet exactcolorttextidtx1ty1ttextendty2tboxidt canvheighttboxtx2((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyt __populateDs8      c Cs%|j}|j|j}|j|j}|j||||}x%|D]}||jkrLPqLqLWdS|jj|}x&|D]}|ddkrPqqWdStj |\} } } d|_ |j j r|j j| | | n0|j| | | | | | |_|_|_dS(Nit#i(R&tcanvasxtxtcanvasytytfind_overlappingRGtgettagsRItrrggbb_to_tripletRR/R0Rt update_viewstupdate_yourselft_ListViewer__redt_ListViewer__greent_ListViewer__blue( R9teventR>ReRgtidsR^RCtttredtgreentblue((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyt __onreleaseds&    cCs5|jjr1|jj|j|j|jndS(N(R/R0RRkRmRnRo(R9Rp((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyt__toggleupdatescCs|jjdS(N(Rtquit(R9Rp((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyt__quitscCs|jjdS(N(RR(R9Rp((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyRscCs|jjdS(N(Rt deiconify(R9Rp((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyRzsc Cs|j}|jr+|j|jddntj|||f}|j|dd||_|jjdty&|jj j |||d}Wn(tj k r|jj tddSX|s|jj tdn$x!|D]}|jj t|qW|j rd|_ ni|j|\}}}} |j|jd\}}}} t|d d } |jd | | | dS( NRARBtblackiiss iRg?tmoveto(R&Rt itemconfigureRIRJR8tdeletetENDRRFt aliases_oftBadColortinsertRRSRGtintR( R9RsRtRuR>tcolortagtaliasesRWtigR[R]th((s7/usr/lib64/python2.7/site-packages/pynche/ListViewer.pyRls,   &   "cCs|jj|ds