File: //opt/alt/python37/lib64/python3.7/site-packages/guppy/etc/__pycache__/textView.cpython-37.pyc
B
�]J � @ sT d Z ddlT ddlZG dd� de�ZedkrPe� Zeeddd � d
�� � e�
� dS )zSimple text browser
� )�*Nc @ s4 e Zd ZdZddd�Zdd� Zdd� Zdd d
�ZdS )
�
TextViewerz,
simple text viewer dialog for idle
Nc C s� t �| |� | jdd� | �ddd|�� d |�� d f � d| _d| _| �� | � |� | �
d | j� || _| j
�� | �d
| j� | �d| j� |dk r�| j
�d
|� n
| �|� | j
jtd� dS )z�If data exists, load it into viewer, otherwise try to load file.
fileName - string, should be an absoulute filename
� )Zborderwidthz=%dx%d+%d+%diq i� �
z#ffffffz#000000ZWM_DELETE_WINDOWz<Return>z<Escape>Ng )�state)�Toplevel�__init__Z configureZgeometryZwinfo_rootxZwinfo_rooty�bg�fg�
CreateWidgets�titleZprotocol�Ok�parent�textViewZ focus_setZbind�insert�LoadTextFile�configZDISABLED)�selfr r �fileName�data� r �E/opt/alt/python37/lib64/python3.7/site-packages/guppy/etc/textView.pyr s$
zTextViewer.__init__c C sZ d }yt |d�}W n0 tk
rB tjjddt|� d d� Y nX | j�d|�� � d S )N�rzFile Load ErrorzUnable to load file z .)r �messageg ) �open�IOError�tkinterZ
messageboxZ showerror�reprr r �read)r r ZtextFiler r r r 3 s zTextViewer.LoadTextFilec C s� t | tdd�}t | �}t|d| jtd�| _t|ttdd�| _t |t
d| j| jd�| _
| jj| j
jd� | j
j| jjd � | j�� | jjttd
� | j
jtttd� |jttd
� |jtttd� d S )Ni� )ZreliefZheightZClose)�text�command� takefocusr )Zorientr! �highlightthickness)Zwrapr"