Your IP : 3.145.80.247
�
e f� � @ s� d Z d d l Td d l j Z Gd d � d e � Z d d d � Z d d d d
� Z e d k r� d d l
Z
e
j d d
d d d �d d l m
Z
e
e � n d S)zSimple text browser for IDLE
� )�*Nc @ sC e Z d Z d Z d d d d � Z d d � Z d d d
� Z d S)�
TextViewerz*A simple text viewer dialog for IDLE
TFc C s) t j | | � | j d d � | j d d d | j � d | j � | sQ d n d f � d | _ d | _ | j � | j | � | j
d
| j � | | _ | j
j � | j d | j � | j d | j � | j
j d
| � | j
j d t � | r%| j | � | j � | j � n d S)aH Show the given text in a scrollable window with a 'close' button
If modal option set to False, user can interact with other windows,
otherwise they will be unable to interact with other windows until
the textview window is closed.
_htest - bool; change box location when running htest.
Zborderwidth� z=%dx%d+%d+%di� i� �
�d z#ffffffz#000000ZWM_DELETE_WINDOWz<Return>z<Escape>g �stateN)�Toplevel�__init__Z configureZgeometryZwinfo_rootxZwinfo_rooty�bg�fg�
CreateWidgets�titleZprotocol�Ok�parent�textViewZ focus_setZbind�insert�configZDISABLEDZ transientZgrab_setZwait_window)�selfr r
�text�modalZ_htest� r �5/opt/alt/python34/lib64/python3.4/idlelib/textView.pyr s(
!
zTextViewer.__init__c
C sC t | d t d d �} t | � } t | d d d | j d t �| _ t | d t d t d d
�| _ t | d t
d d
d | j d
| j �| _
| j j d | j
j � | j
j d | j j � | j j � | j j d t d t � | j
j d t d t d t � | j d t d t � | j d t d t d t � d S)NZreliefZheighti� r ZCloseZcommandZ takefocusZorientZhighlightthicknessr Zwrapr r
ZyscrollcommandZsideZfill�expand)ZFrameZSUNKENZButtonr ZFALSEZbuttonOkZ ScrollbarZVERTICALZ
scrollbarViewZTextZWORDr r
r r Zyview�setZpackZRIGHT�YZLEFTZTRUEZBOTHZBOTTOM�XZTOP)r Z frameTextZframeButtonsr r r r / s
zTextViewer.CreateWidgetsNc C s | j � d S)N)Zdestroy)r Zeventr r r r @ s z
TextViewer.Ok)�__name__�
__module__�__qualname__�__doc__r r r r r r r r s #r Tc C s t | | | | � S)N)r )r r
r r r r r � view_textD s r c C sz y. t | d d | �� } | j � } Wd QXWn2 t k
rb t j d d d d | d | � Yn Xt | | | | � Sd S)N�r�encodingr
zFile Load Error�messagezUnable to load file %r .r )�open�read�IOError�tkMessageBoxZ showerrorr )r r
�filenamer"