Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/textview.cpython-36.opt-1.pyc

3

� f��@s�dZddlmZmZmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
mZddlmZddlmZGdd�de
�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Zddd�Zddd�Zedkr�ddlmZedddd�ddlmZee�dS)zSimple text browser for IDLE

�)	�Toplevel�Text�TclError�
HORIZONTAL�VERTICAL�N�S�E�W)�Frame�	Scrollbar�Button)�	showerror)�color_configcs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�AutoHiddenScrollbarzpA scrollbar that is automatically hidden when not needed.

    Only the grid geometry manager is supported.
    cs<t|�dkst|�dkr"|j�n|j�t�j||�dS)Ngg�?)�float�gridZgrid_remove�super�set)�self�lo�hi)�	__class__��5/opt/alt/python36/lib64/python3.6/idlelib/textview.pyrs
zAutoHiddenScrollbar.setcKst|jj�d���dS)Nz does not support "pack")rr�__name__)r�kwargsrrr�packszAutoHiddenScrollbar.packcKst|jj�d���dS)Nz does not support "place")rrr)rrrrr�placeszAutoHiddenScrollbar.place)r�
__module__�__qualname__�__doc__rrr�
__classcell__rr)rrrsrcs"eZdZdZd�fdd�	Z�ZS)�	TextFramezDisplay text with scrollbar.�wordcst�j|�d|d<d|d<t||dd�|_}t|�|jddtttt	d�|j
ddd	�|jddd	�|jd
|�d|d<|j
�t|td
|jd�|_}|j|d<|jddttd�|dk�rt|td
|jd�|_}|j|d<|jddtt	d�dS)zvCreate a frame for Textview.

        parent - parent widget for this frame
        rawtext - text to display
        ZsunkenZreliefi�Zheightr)�wrapZhighlightthickness)�row�columnZsticky�)ZweightgZdisabled�stateF)Zorient�	takefocus�commandZyscrollcommandZnoneZxscrollcommandN)r�__init__r�textrrrrr	r
Zgrid_rowconfigureZgrid_columnconfigure�insertZ	focus_setrrZyview�yscrollrrZxview�xscroll)r�parentZrawtextr%r-r/r0)rrrr,"s,


zTextFrame.__init__)r$)rrr r!r,r"rr)rrr#sr#cs,eZdZdZd�fdd�	Zd	dd�Z�ZS)
�	ViewFramez#Display TextFrame and Close button.r$csxt�j|�||_|jd|j�|jd|j�t|||d�|_t|d|jdd�|_}|jj	ddd	d
�|j	dd�dS)
Nz<Return>z<Escape>)r%�CloseF)r-r+r*�topT�both)�side�expand�fillZbottom)r6)
rr,r1Zbind�okr#Z	textframer
�	button_okr)rr1r-r%r:)rrrr,GszViewFrame.__init__NcCs|jj�dS)zDismiss text viewer dialog.N)r1�destroy)r�eventrrrr9RszViewFrame.ok)r$)N)rrr r!r,r9r"rr)rrr2Esr2cs4eZdZdZdddd��fdd�Zdd	d
�Z�ZS)
�
ViewWindowz%A simple text viewer dialog for IDLE.Tr$F)�_htest�_utestcs�t�j|�d|d<|j�d}|j�|s.dnd}	|jd|�d|	���|j|�t|||d�|_|jd|j	�t
|d	|j	d
d�|_}
|jjdd
dd�||_
|j
r�|j|�|j�|s�|j�dS)a
Show the given text in a scrollable window with a 'close' button.

        If modal is left True, users cannot interact with other windows
        until the textview window is closed.

        parent - parent of this dialog
        title - string which is title of popup dialog
        text - text to display in dialog
        wrap - type of text wrapping to use ('word', 'char' or 'none')
        _htest - bool; change box location when running htest.
        _utest - bool; don't wait_window when running unittest.
        �Zborderwidth�
�dz	=750x500+�+)r%ZWM_DELETE_WINDOWr3F)r-r+r*r4Tr5)r6r7r8N)rr,Zwinfo_rootxZwinfo_rootyZgeometry�titler2Z	viewframeZprotocolr9r
r:r�is_modalZ	transientZgrab_setZwait_window)rr1rDr-�modalr%r>r?�x�yr:)rrrr,Zs"

zViewWindow.__init__NcCs|jr|j�|j�dS)zDismiss text viewer dialog.N)rEZgrab_releaser;)rr<rrrr9}sz
ViewWindow.ok)Tr$)N)rrr r!r,r9r"rr)rrr=Ws"r=Tr$FcCst||||||d�S)a�Create text viewer for given text.

    parent - parent of this dialog
    title - string which is the title of popup dialog
    text - text to display in this dialog
    wrap - type of text wrapping to use ('word', 'char' or 'none')
    modal - controls if users can interact with other windows while this
            dialog is displayed
    _utest - bool; controls wait_window on unittest
    )r%r?)r=)r1rDr-rFr%r?rrr�	view_text�srIc
Cs�y&t|d|d��}|j�}WdQRXWn\tk
rPtdd|�d�|d�YnHtk
r�}	ztdt|	�|d�WYdd}	~	XnXt||||||d	�SdS)
z�Create text viewer for text in filename.

    Return error message if file cannot be read.  Otherwise calls view_text
    with contents of the file.
    �r)�encodingNzFile Load ErrorzUnable to load file z .)rD�messager1zUnicode Decode Error)r%r?)�open�read�OSErrorr�UnicodeDecodeError�strrI)
r1rD�filenamerKrFr%r?�file�contents�errrrr�	view_file�s
rV�__main__)�mainzidlelib.idle_test.test_textview�)�	verbosity�exit)�runN)Tr$F)Tr$F)r!Ztkinterrrrrrrrr	r
Ztkinter.ttkrrr
Ztkinter.messageboxrZidlelib.colorizerrrr#r2r=rIrVrZunittestrXZidlelib.idle_test.htestr\rrrr�<module>s ,&-



Hacked By AnonymousFox1.0, Coded By AnonymousFox