Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/__pycache__/textview.cpython-312.pyc

�

&Μg����dZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZddl
mZmZmZddlmZddlmZGd�de�ZGd�d	e�ZGd
�de�ZGd�d
e�Zdd�Z		dd�Zedk(r ddlmZeddd��ddlmZee�yy)zSimple text browser for IDLE

�)�Toplevel�Text�TclError�
HORIZONTAL�VERTICAL�NS�EW�NSEW�NONE�WORD�SUNKEN)�Frame�	Scrollbar�Button)�	showerror)�color_configc�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�AutoHideScrollbarzpA scrollbar that is automatically hidden when not needed.

    Only the grid geometry manager is supported.
    c���t|�dkDst|�dkr|j�n|j�t�|�||�y)Ngg�?)�float�grid�grid_remove�super�set)�self�lo�hi�	__class__s   ��-/usr/local/lib/python3.12/idlelib/textview.pyrzAutoHideScrollbar.sets;�����9�s�?�e�B�i�#�o��I�I�K�����
���B���c�F�t|jj�d���)Nz does not support "pack"�rr�__name__�r�kwargss  r�packzAutoHideScrollbar.packs ���$�.�.�1�1�2�2J�K�L�Lr c�F�t|jj�d���)Nz does not support "place"r"r$s  r�placezAutoHideScrollbar.places ���$�.�.�1�1�2�2K�L�M�Mr )r#�
__module__�__qualname__�__doc__rr&r(�
__classcell__�rs@rrrs�����M�Nr rc�&��eZdZdZef�fd�	Z�xZS)�ScrollableTextFramezDisplay text with scrollbar(s).c�`��t�|�|fi|��t||��x}|_|j	ddt
��|j
dd��|jdd��t|td|j��|_|jj	ddt��|jj|d<|tk(r^t|td|j ��|_|j"j	ddt$��|j"j|d	<y
d
|_y
)a�Create a frame for Textview.

        master - master widget for this frame
        wrap - type of text wrapping to use ('word', 'char' or 'none')

        All parameters except for 'wrap' are passed to Frame.__init__().

        The Text widget is accessible via the 'text' attribute.

        Note: Changing the wrapping mode of the text widget after
        instantiation is not supported.
        ��wrapr)�row�column�sticky�)�weightF)�orient�	takefocus�command�yscrollcommand�xscrollcommandN)r�__init__r�textrr
�grid_rowconfigure�grid_columnconfigurerr�yview�yscrollrrrr�xview�xscrollr	)r�masterr2r%r>rs     �rr=zScrollableTextFrame.__init__"s	���	����*�6�*���4�0�0��t�y��	�	�a��$�	�/����q���+��!�!�!�A�!�.�)��h�38�15���=���	
�����a��"��5�!%���!1�!1��
���4�<�,�T�*�7<�59�Z�Z�A�D�L�
�L�L���!�A�b��9�%)�\�\�%5�%5�D�!�"��D�Lr )r#r)r*r+rr=r,r-s@rr/r/s���)�$(�# �# r r/c�,��eZdZdZd�fd�	Zdd�Z�xZS)�	ViewFramez#Display TextFrame and Close button.c�,��t�|�|�||_|jd|j�|jd|j�t|td��|_|jjx}|_|jd|�|j|dd��t|�|j�t|d	|jd
��x|_}|jjdd
d��|jd��y)aCreate a frame for viewing text with a "Close" button.

        parent - parent widget for this frame
        contents - text to display
        wrap - type of text wrapping to use ('word', 'char' or 'none')

        The Text widget is accessible via the 'text' attribute.
        z<Return>z<Escape>i�)�relief�heightz1.0r�disabled)r2�highlightthickness�state�CloseF�r>r:r9�topT�both��side�expand�fill�bottom)rSN)rr=�parent�bind�okr/r
�	textframer>�insert�	configurer�	focus_setr�	button_okr&)rrW�contentsr2r>r^rs      �rr=zViewFrame.__init__Js����	���� �����	�	�*�d�g�g�&��	�	�*�d�g�g�&�,�T�&��M����>�>�.�.�.��t�y����E�8�$����D�Q�j��I��T������%+��7�D�G�G�u�&F�	F����������t�&��A����H��%r c�8�|jj�y�zDismiss text viewer dialog.N)rW�destroy�r�events  rrYzViewFrame.okds�������r )�word�N)r#r)r*r+r=rYr,r-s@rrGrGHs���)�&�4r rGc�8��eZdZdZdefddd��fd�Zdd�Z�xZS)�
ViewWindowz%A simple text viewer dialog for IDLE.TF)�_htest�_utestc�<��t�|�|�d|d<|j�dz}|j�|sdndz}	|j	d|�d|	���|j|�t
|||��|_|jd|j�t|d	|jd
��x|_}
|jjdd
d��||_
|jr5|j|�|j�|s|j!�yyy)aShow 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
        contents - 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.
        ��borderwidth�
�dz	=750x500+�+r1�WM_DELETE_WINDOWrNFrOrPTrQrRN)rr=�winfo_rootx�winfo_rooty�geometry�titlerG�	viewframe�protocolrYrr^r&�is_modal�	transient�grab_set�wait_window)rrWrur_�modalr2rirj�x�yr^rs           �rr=zViewWindow.__init__ls���	���� ���]����� �2�%����� �f�B�#�>���
�
�	�!��A�a�S�)�*��
�
�5��"�4���=����
�
�(�$�'�'�2�%+�D�w�48�G�G�u�&N�	N����������t�&��A���
��=�=��N�N�6�"��M�M�O��� � �"��r c�\�|jr|j�|j�yra)rx�grab_releaserbrcs  rrYz
ViewWindow.ok�s���=�=��������r rf)r#r)r*r+rr=rYr,r-s@rrhrhis ���+�6:��!#� ��!#�Fr rhFc�$�t||||||��S)a�Create text viewer for given text.

    parent - parent of this dialog
    title - string which is the title of popup dialog
    contents - 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
    �r2rj)rh)rWrur_r|r2rjs      r�	view_textr��s���f�e�X�u�4��O�Or c��	t||��5}|j�}ddd�t|||||��S#1swY�xYw#t$rt	dd|�d�|��Yyt
$r!}	t	dt
|	�|��Yd}	~	yd}	~	wwxYw)	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.
    )�encodingNr�zFile Load ErrorzUnable to load file z .)ru�messagerWzUnicode Decode Error)�open�readr��OSErrorr�UnicodeDecodeError�str)
rWru�filenamer�r|r2rj�filer_�errs
          r�	view_filer��s���
(�
�(�X�
.�$��y�y�{�H�/�����%�d� &�(�	(�/�
.���!��)�0���B�?��	!���!��.��c�(��	!�	!���!�s0�
A�9�A�A�A�B�"B�*B�B�__main__)�mainzidlelib.idle_test.test_textview�)�	verbosity�exit)�runN)TreF) r+�tkinterrrrrrrr	r
rrr
�tkinter.ttkrrr�tkinter.messageboxr�idlelib.colorizerrrr/rGrhr�r�r#�unittestr��idlelib.idle_test.htestr��r r�<module>r�s����;�;�;�;�0�0�(�*�N�	�N�&& �%�& �R���B*��*�ZP�CI���0�z����	*�a�e�D�+��
�O�r 

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists