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__/TextViewer.cpython-37.opt-1.pyc

B

� f��@s*dZddlTddlZdZGdd�d�ZdS)a(TextViewer class.

The TextViewer allows you to see how the selected color would affect various
characteristics of a Tk text widget.  This is an output viewer only.

In the top part of the window is a standard text widget with some sample text
in it.  You are free to edit this text in any way you want (BAW: allow you to
change font characteristics).  If you want changes in other viewers to update
text characteristics, turn on Track color changes.

To select which characteristic tracks the change, select one of the radio
buttons in the window below.  Text foreground and background affect the text
in the window above.  The Selection is what you see when you click the middle
button and drag it through some text.  The Insertion is the insertion cursor
in the text window (which only has a background).
�)�*NzText Window...c@sbeZdZddd�Zddd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Z	dd�Z
dd�ZdS)�
TextViewerNcCs||_|��}t|dd�}|_|�d|j�|�d�|�d�|�d|j	�|�d|j	�|�d|j�|�d|j�t
|t|�d	d
�|�dd�d
dd�|_
|�d�}|r�|j
j|d�|�d�}|r�|j
j|d�|�d�}|r�|j
j|d�|j
��|j
�d|�dd��|�d�}|�r2|j
�t|�y(|�ddtf�\}	}
|j
�t|	|
�Wntk
�rpYnX|j
��t�|_|j�|�dd��t�|_|j�|�dd��t|d|jt|jd �|_ |j jt!t"d!�t#|�}|_$|��g|_%d"}x>d#D]6}
t&||
d$�}|j'|dt(d%�|j%�)|�|d&7}�qWd&}x<d'D]4}
t&||
d$�}|j'd&|d(�|j%�)|�|d&7}�qFWg|_*xtd)D]l}xdd*D]\}|d+k�r�|d&k�r��q�t+||j|d"d"|d&|j,d,�}|j'||d(�|j*�)|��q�W�q�W|��dS)-NZPynche)Zclass_ZWM_DELETE_WINDOWzPynche Text Windowz<Alt-q>z<Alt-Q>z<Alt-w>z<Alt-W>�TEXTBGZblack�TEXTFGZwhite�#�)�relief�
background�
foreground�widthZheight�TEXT_SFG)�selectforeground�TEXT_SBG)�selectbackground�TEXT_IBG)�insertbackgroundg�TEXTz�Insert some stuff here and play
with the buttons below to see
how the colors interact in
textual displays.

See how the selection can also
be affected by tickling the buttons
and choosing a color.�TEXTINS�TEXTSELg@�TRACKPr�WHICHzTrack color changes)�text�variabler�command)Zfill�expand�)zText:z
Selection:z
Insertion:)r)�row�columnZsticky�)Z
ForegroundZ
Background)rr)rr)r��r )r�valuer)-�_TextViewer__sb�optiondbZToplevel�_TextViewer__rootZprotocol�withdraw�titleZiconnameZbind�_TextViewer__quitZTextZSUNKEN�get�_TextViewer__text�	configureZpack�insertZmark_set�INSERTZENDZtag_add�SEL�
ValueErrorZ	focus_setZ
BooleanVar�_TextViewer__trackp�setZIntVar�_TextViewer__whichZCheckbuttonZGROOVE�_TextViewer__toggletrackZ_TextViewer__t�XZYESZFrameZ_TextViewer__frame�_TextViewer__labelsZLabelZgrid�E�append�_TextViewer__radiosZRadiobutton�_TextViewer__set_color)�selfZswitchboardZmasterr#�rootZsfgZsbgZibgr+�start�end�framerr�l�col�r�rA�</opt/alt/python37/lib64/python3.7/Tools/pynche/TextViewer.py�__init__s�














zTextViewer.__init__cCs|j��dS)N)r$�quit)r9�eventrArArBZ__quitvszTextViewer.__quitcCs|j��dS)N)r$r%)r9rErArArBr%yszTextViewer.withdrawcCs|j��dS)N)r$�	deiconify)r9rErArArBrF|szTextViewer.deiconifycCs|j��dS)N)r"Zupdate_views_current)r9rErArArBZ
__forceupdateszTextViewer.__forceupdatecCsl|j��rt}|jdd}nt}|jdd}x|jD]}|j|d�q8Wx|jD]}|j|d�qTWdS)Nrr
Zdisabledforeground)�state)r
)r/r(ZNORMALr7ZDISABLEDr*r4)r9rErGZfgr@r>rArArBZ
__toggletrack�s
zTextViewer.__toggletrackcCs�|j��}|j}|dkr"|d}nF|dkr4|d}n4|dkrF|d}n"|dkrX|d}n|d	krh|d
}yt�|�\}}}Wn,tjk
r�|j���|�\}}}YnX|j�	|||�dS)Nrr
rr	rr
rr�r)
r1r(r)�ColorDBZrrggbb_to_tripletZBadColorr"ZcolordbZfind_bynameZupdate_views)r9rE�whichrZcolor�red�green�bluerArArBZ__set_color�s"




zTextViewer.__set_colorcCs�|j��r�t�|||f�}|j��}|j}|dkr@|j|d�nV|dkrV|j|d�n@|dkrl|j|d�n*|dkr�|j|d�n|d	kr�|j|d
�dS)Nr)r
r)r	r)r
r)rrH)r)r/r(rIZtriplet_to_rrggbbr1r)r*)r9rKrLrMZ	colornamerJrrArArB�update_yourself�s

zTextViewer.update_yourselfcCs�|j��|d<|j��|d<|j�dd�|d<|j�t�dd�|d<|j�t�|d	<|jd
|d<|jd|d
<|jd|d<|jd|d<|jd|d<dS)Nrrgzend - 1crrrrrr
rr	rr
rrrrr)r/r(r1r)Z
tag_rangesr-�indexr,)r9r#rArArB�save_options�szTextViewer.save_options)N)N)N)N)N)N)N)�__name__�
__module__�__qualname__rCr'r%rFZ_TextViewer__forceupdater2r8rNrPrArArArBrs
\





r)�__doc__ZtkinterrIZ	ADDTOVIEWrrArArArB�<module>s