Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/Tools/pynche/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/Tools/pynche/__pycache__/ListViewer.cpython-36.opt-1.pyc

3

� f��@s*dZddlTddlZdZGdd�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@sheZdZddd�Zdd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Z	dd�Z
dd�Zdd�ZdS)�
ListViewerNcCs�||_|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td
�}|_t|�|_|jjttd�|jtdd�|j|jdfd�|jj|dfd�|j�t�|_|jj|jdd��t|d|j|jd�|_|jjdtd�t |dd�|_!|j!j�t"|dt#d�|_$|j$jdtd�dS)NrZPynche)Zclass_ZWM_DELETE_WINDOWzPynche Color Listz<Alt-q>z<Alt-Q>z<Alt-w>z<Alt-W>�i,�)�width�heightZborderwidthZrelief)�fillZside�)r�expand�set)Zyscrollcommand�yview)�command�	UPONCLICKzUpdate on Click)�textZvariabler
)r
rzAliases:)r�)rZ
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/python36/lib64/python3.6/Tools/pynche/ListViewer.py�__init__sD




zListViewer.__init__c	CsR|jj�}|j}d}d}g}|_x�|j�D]�}tj|j|��}|jd|ddd|dd|d�|j	d|dd|t
d�}|j|�\}	}
}}|jd|dd|d|dd	d
|dfd�}
|jd
|j
�|j|
�|d|kr�|d}|d7}q,W|ddd}|jddd|fd�x2|D]*}|j|�\}	}
}}|j||	|
||��q WdS)Nrr�)r��
)rZanchor����all)�outline�tagsz<ButtonRelease>r	�)Zscrollregion)r�colordbr�_ListViewer__bboxesZunique_names�ColorDB�triplet_to_rrggbbZfind_bynameZcreate_rectangleZcreate_text�WZbboxr�_ListViewer__onrelease�append�config�coords)r!r2r$�rowZwidestZbboxes�nameZ
exactcolorZtextidZx1�y1Ztextend�y2�boxidZ
canvheightZboxZx2r%r%r&Z
__populateDs8



zListViewer.__populatecCs�|j}|j|j�}|j|j�}|j||||�}x|D]}||jkr4Pq4WdS|jj|�}x|D]}|ddkr^Pq^WdStj	|�\}	}
}d|_
|jj�r�|j
j|	|
|�n$|j|	|
|�|	|
||_|_|_dS)Nr�#r	)rZcanvasx�xZcanvasy�yZfind_overlappingr3Zgettagsr4Zrrggbb_to_tripletrrrr�update_views�update_yourself�_ListViewer__red�_ListViewer__green�_ListViewer__blue)r!�eventr$rArBZidsr?r0�t�red�green�bluer%r%r&Z__onreleaseds&



zListViewer.__onreleasecCs$|jj�r |jj|j|j|j�dS)N)rrrrCrErFrG)r!rHr%r%r&Z__toggleupdates
zListViewer.__toggleupdatecCs|jj�dS)N)r�quit)r!rHr%r%r&Z__quit�szListViewer.__quitcCs|jj�dS)N)rr)r!rHr%r%r&r�szListViewer.withdrawcCs|jj�dS)N)r�	deiconify)r!rHr%r%r&rN�szListViewer.deiconifycCs$|j}|jr|j|jdd�tj|||f�}|j|dd�||_|jjdt�y |jj	�j
|||�dd�}Wn$tjk
r�|jjtd�dSX|s�|jjtd�nx|D]}|jjt|�q�W|j
r�d|_
nN|j|�\}}}}	|j|jd�\}}}}
t|d�d	}|jd
|	||
�dS)Nr-)r/Zblackrr	z<no matching color>z<no aliases>rg�?Zmoveto���)rrZ
itemconfigurer4r5r �deleteZENDrr2Z
aliases_ofZBadColor�insertrr:r3�intr)r!rJrKrLr$Zcolortag�aliasesr<Zigr=r>�hr%r%r&rD�s, 
zListViewer.update_yourselfcCs|jj�|d<dS)Nr)rr)r!rr%r%r&�save_options�szListViewer.save_optionscCs|jjd�|j�dS)Nr.)rrPr)r!r2r%r%r&�colordb_changed�szListViewer.colordb_changed)N)N)N)N)N)N)
�__name__�
__module__�__qualname__r'rr7rrrrNrDrUrVr%r%r%r&rs
, 




r)�__doc__Ztkinterr4Z	ADDTOVIEWrr%r%r%r&�<module>s