Your IP : 216.73.216.213
B
� f� � @ s* d Z ddlT ddlZdZG dd� d�ZdS )a ListViewer 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 @ sh e Zd Zddd�Zdd� Zddd�Zddd �Zdd
d�Zddd
�Zddd�Z dd� Z
dd� Zdd� ZdS )�
ListViewerNc C s� || _ |�� }d | _d| _t|dd� }| _|�d| j� |�d� |� d� |�
d| j� |�
d| j� |�
d| j� |�
d | j� t|� }| _
|�� t|d
ddtd
� }| _t|�| _| jjttd� |jtdd� |j| jdfd� | jj|dfd� | �� t� | _| j�|�dd�� t|d| j| jd�| _| jjdtd� t |dd�| _!| j!�� t"|dt#d�| _$| j$jdtd� d S )Nr ZPynche)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
r zAliases:)r � )r 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/python37/lib64/python3.7/Tools/pynche/ListViewer.py�__init__ sD
zListViewer.__init__c C sR | j �� }| j}d}d}g }| _x�|�� D ]�}t�|�|��}|jd|d d d|d d |d� |j d|d d |t
d�}|�|�\} }
}}|jd|d d |d |d d d
|dfd�}
|�d
| j
� |�|
� |d |kr�|d }|d7 }q,W |d d d }|jddd|fd� x2|D ]*}|�|�\} }
}}|�|| |
||� �q W d S )Nr r � )r � �
)r Zanchor� � � �all)�outline�tagsz<ButtonRelease>r � )Zscrollregion)r �colordbr �_ListViewer__bboxesZunique_names�ColorDB�triplet_to_rrggbbZfind_bynameZcreate_rectangleZcreate_text�WZbboxr �_ListViewer__onrelease�appendZconfig�coords)r! r2 r$ �rowZwidestZbboxes�nameZ
exactcolorZtextidZx1�y1Ztextend�y2�boxidZ
canvheightZboxZx2r% r% r&