Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/Tools/pynche/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Tools/pynche/__pycache__/ListViewer.cpython-37.opt-1.pyc

B

� 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�||_|��}d|_d|_t|dd�}|_|�d|j�|�d�|�	d�|�
d|j�|�
d|j�|�
d|j�|�
d	|j�t|�}|_
|��t|d
ddtd
�}|_t|�|_|jjttd�|jtdd�|j|jdfd�|jj|dfd�|��t�|_|j�|�dd��t|d|j|jd�|_|jjdtd�t |dd�|_!|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/python37/lib64/python3.7/Tools/pynche/ListViewer.py�__init__sD




zListViewer.__init__c	CsR|j��}|j}d}d}g}|_x�|��D]�}t�|�|��}|jd|ddd|dd|d�|j	d|dd|t
d�}|�|�\}	}
}}|jd|dd|d|dd	d
|dfd�}
|�d
|j
�|�|
�|d|kr�|d}|d7}q,W|ddd}|jddd|fd�x2|D]*}|�|�\}	}
}}|�||	|
||��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�appendZconfig�coords)r!r2r$�rowZwidestZbboxes�nameZ
exactcolorZtextidZx1�y1Ztextend�y2�boxidZ
canvheightZboxZx2r%r%r&Z
__populateDs8

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



zListViewer.__onreleasecCs$|j��r |j�|j|j|j�dS)N)rrrrBrDrErF)r!rGr%r%r&Z__toggleupdates
zListViewer.__toggleupdatecCs|j��dS)N)r�quit)r!rGr%r%r&Z__quit�szListViewer.__quitcCs|j��dS)N)rr)r!rGr%r%r&r�szListViewer.withdrawcCs|j��dS)N)r�	deiconify)r!rGr%r%r&rM�szListViewer.deiconifycCs$|j}|jr|j|jdd�t�|||f�}|j|dd�||_|j�dt�y |j�	��
|||�dd�}Wn$tjk
r�|j�td�dSX|s�|j�td�nx|D]}|j�t|�q�W|j
r�d|_
nN|�|�\}}}}	|�|jd�\}}}}
t|d	�d
}|�d|	||
�dS)Nr-)r/Zblackrr	z<no matching color>z<no aliases>���rg�?Zmoveto)rrZ
itemconfigurer4r5r �deleteZENDrr2Z
aliases_ofZBadColor�insertrr9r3�intr)r!rIrJrKr$Zcolortag�aliasesr;Zigr<r=�hr%r%r&rC�s, 
zListViewer.update_yourselfcCs|j��|d<dS)Nr)rr)r!rr%r%r&�save_options�szListViewer.save_optionscCs|j�d�|��dS)Nr.)rrOr)r!r2r%r%r&�colordb_changed�szListViewer.colordb_changed)N)N)N)N)N)N)
�__name__�
__module__�__qualname__r'rr7rrrrMrCrTrUr%r%r%r&rs
, 




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