Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Tools/pynche/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Tools/pynche/__pycache__/ListViewer.cpython-35.opt-1.pyc



��Yf��@s9dZddlTddlZdZGdd�d�ZdS)aListViewer 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.
�)�*NzColor %List Window...c@s�eZdZddd�Zdd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Z	dd�Z
dd�Zdd�ZdS)�
ListViewerNc
Cs=||_|j�}d|_d|_t|dd�}|_|jd|j�|jd�|j	d�|j
d|j�|j
d|j�|j
d|j�|j
d	|j�t|�}|_
|j�t|d
ddd
dddt�}|_t|�|_|jjdtdt�|jdtdd�|jd|jdf�|jjd|df�|j�t�|_|jj|jdd��t|ddd|jd|j�|_|jjdddt�t |dd�|_!|j!j�t"|dddt#�|_$|j$jdddt�dS) NrZclass_ZPyncheZWM_DELETE_WINDOWzPynche Color Listz<Alt-q>z<Alt-Q>z<Alt-w>z<Alt-W>�width��heighti,Zborderwidth�Zrelief�fillZside�expand�Zyscrollcommand�setZcommand�yview�	UPONCLICK�textzUpdate on ClickZvariablezAliases:�Z
selectmode)%�_ListViewer__sb�optiondb�_ListViewer__lastbox�_ListViewer__dontcenterZToplevel�_ListViewer__rootZprotocol�withdraw�titleZiconname�bind�_ListViewer__quitZFrameZ_ListViewer__frameZpackZCanvasZSUNKEN�_ListViewer__canvasZ	ScrollbarZ_ListViewer__scrollbar�YZRIGHTZBOTHZ	configure�_ListViewer__populateZ
BooleanVar�_ListViewer__uocr�getZCheckbutton�_ListViewer__toggleupdateZ_ListViewer__uocbtnZLabelZ_ListViewer__alabelZListboxZBROWSE�_ListViewer__aliases)�selfZswitchboardZmasterr�root�frame�canvas�r$�</opt/alt/python35/lib64/python3.5/Tools/pynche/ListViewer.py�__init__sD			



		
zListViewer.__init__cCs�|jj�}|j}d}d}g}|_x|j�D]
}tj|j|��}|jd|ddd|ddd|�|j	d|ddd|dt
�}|j|�\}	}
}}|jd	|dd	|d	|dd
ddd
|df�}
|jd|j
�|j|
�|d	|krA|d	}|d7}q>W|ddd}|jdddd|f�xB|D]:}|j|�\}	}
}}|j||	|
||�q�WdS)Nrr�r��
rZanchor���outline��tags�allz<ButtonRelease>r
Zscrollregion�)r�colordbr�_ListViewer__bboxesZunique_names�ColorDB�triplet_to_rrggbbZfind_bynameZcreate_rectangleZcreate_text�WZbboxr�_ListViewer__onrelease�append�config�coords)r r1r#�rowZwidestZbboxes�nameZ
exactcolorZtextidZx1�y1Ztextend�y2�boxidZ
canvheightZboxZx2r$r$r%Z
__populateDs8	
	


zListViewer.__populatecCs|j}|j|j�}|j|j�}|j||||�}x"|D]}||jkrLPqLWdS|jj|�}x#|D]}|ddkr�Pq�WdStj	|�\}	}
}d|_
|jj�r�|j
j|	|
|�n0|j|	|
|�|	|
||_|_|_dS)Nr�#r
)rZcanvasx�xZcanvasy�yZfind_overlappingr2Zgettagsr3Zrrggbb_to_tripletrrrr�update_views�update_yourself�_ListViewer__red�_ListViewer__green�_ListViewer__blue)r �eventr#r@rAZidsr>r.�t�red�green�bluer$r$r%Z__onreleaseds&	

	zListViewer.__onreleasecCs2|jj�r.|jj|j|j|j�dS)N)rrrrBrDrErF)r rGr$r$r%Z__toggleupdateszListViewer.__toggleupdatecCs|jj�dS)N)r�quit)r rGr$r$r%Z__quit�szListViewer.__quitcCs|jj�dS)N)rr)r rGr$r$r%r�szListViewer.withdrawcCs|jj�dS)N)r�	deiconify)r rGr$r$r%rM�szListViewer.deiconifycCs�|j}|jr(|j|jdd�tj|||f�}|j|dd�||_|jjdt�y,|jj	�j
|||�dd�}Wn,tjk
r�|jjtd�dSYnX|s�|jjtd�n$x!|D]}|jjt|�q�W|j
rd|_
ni|j|�\}}}}	|j|jd�\}}}}
t|d�d	}|jd
|	||
�dS)Nr,r-Zblackrr
z<no matching color>z<no aliases>rg�?Zmoveto���)rrZ
itemconfigurer3r4r�deleteZENDrr1Z
aliases_ofZBadColor�insertrr9r2�intr)r rIrJrKr#Zcolortag�aliasesr;Zigr<r=�hr$r$r%rC�s,			,	
	"zListViewer.update_yourselfcCs|jj�|d<dS)Nr
)rr)r rr$r$r%�save_options�szListViewer.save_optionscCs|jjd�|j�dS)Nr/)rrOr)r r1r$r$r%�colordb_changed�szListViewer.colordb_changed)
�__name__�
__module__�__qualname__r&rr6rrrrMrCrTrUr$r$r$r%rs, r)�__doc__Ztkinterr3Z	ADDTOVIEWrr$r$r$r%�<module>s