Sindbad~EG File Manager

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

�

%Μg?��.�ddlZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZdjd�eD��Zd	Zej"d
k(rdndZGd
�d�Zd�Zedk(r ddlmZeddd��ddlmZee�yy)�N)�
filedialog)�
messagebox)�	askstring)�idleConf)�
py_extensions� c#�&K�|]	}d|z���y�w)�*N�)�.0�exts  �+/usr/local/lib/python3.12/idlelib/iomenu.py�	<genexpr>rs����:�M�S��S��M�s��utf-8�win32�
surrogatepass�surrogateescapec���eZdZd�Zd�Zd�Zd�Zd�ZdZd�Z	dZ
dZd�Zdd	�Z
ejZd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZdZdZdedfddfZej>dk(rdndZ d�Z!dd�Z"d�Z#d�Z$y) �	IOBindingc���||_|j|_|jjd|j�|_|jjd|j
�|_|jjd|j�|_|jjd|j�|_
d|_|jjd|j�|_
y)N�<<open-window-from-file>>�<<save-window>>�<<save-window-as-file>>�<<save-copy-of-window-as-file>>r�<<print-window>>)�editwin�text�bind�open�_IOBinding__id_open�save�_IOBinding__id_save�save_as�_IOBinding__id_saveas�save_a_copy�_IOBinding__id_savecopy�fileencoding�print_window�_IOBinding__id_print)�selfrs  r�__init__zIOBinding.__init__s�������L�L��	������(C�T�Y�Y�O��������(9�4�9�9�E����9�9�>�>�*C�*.�,�,�8���!�Y�Y�^�^�,M�,0�,<�,<�>���#����)�)�.�.�);�T�=N�=N�O���c��|jjd|j�|jjd|j�|jjd|j�|jjd|j
�|jjd|j�d|_d|_d|_y)Nrrrrr)	r�unbindr r"r$r&r)r�filename_change_hook�r*s r�closezIOBinding.close%s����	�	���4�d�n�n�E��	�	���*�D�N�N�;��	�	���2�4�3C�3C�D��	�	���:�D�<N�<N�O��	�	���+�T�_�_�=������	�$(��!r,c�6�|jj�S�N)r�	get_savedr0s rr4zIOBinding.get_saved1s���|�|�%�%�'�'r,c�:�|jj|�yr3)r�	set_saved�r*�flags  rr6zIOBinding.set_saved4s�������t�$r,c�8�|jj�yr3)r�
reset_undor0s rr:zIOBinding.reset_undo7s�������!r,Nc��||_yr3)r/)r*�hooks  r�set_filename_change_hookz"IOBinding.set_filename_change_hook<s
��$(��!r,c���|r.tjj|�rd|_||_y||_d|_|jd�|jr|j
�yy)N�)�os�path�isdir�filename�dirnamer6r/�r*rCs  r�set_filenamezIOBinding.set_filenameBsV������
�
�h�/� �D�M�#�D�L�$�D�M��D�L��N�N�1���(�(��)�)�+�)r,c��|jj}|r�|s|j�}n|}|rn|jrPt|jdd�s9|js-|j�r|j
||j�y|j
|�y|jr|jj�y|j�r0|j�}|dk(r|jj�y|s|j�}n|}|r|j|�y|jj�y)N�interp�break�cancel)r�flist�askopenfile�getattrrCr4r�loadfiler�	focus_set�	maybesave)r*�event�editFilerKrC�replys      rrzIOBinding.openMs�����"�"�����+�+�-��!����L�L�#�D�L�L�(�D�A� �M�M����(��J�J�x����7��	�J�J�x�(���9�9��I�I�'�'�)���>�>���N�N�$�E��� ��	�	�#�#�%����'�'�)�H��H���M�M�(�#��
�I�I���!�r,c��		tj|�5}|j�}|j}|j}d}ddd�tt�s6|�$tj dd
|j�	�d}t"j$}|jj'dd�|j)d�|_||_|jj/d�|j1�|j)|�r|j3d�|jj5dd�|jj7d�|j9|�y#1swY��$xYw#t
tf$r�|jjj�tddd|jj��}t||��5}|j�}|j}|j}d}ddd�n#1swYnxYwY���wxYw#t$r5}tjdt|�|j�	�Yd}~yd}~wt
$r(tjd
d|z|j�	�YywxYw)NFzSpecify file encodingzwThe file's encoding is invalid for Python 3.x.
IDLE will convert it to UTF-8.
What is the current encoding of the file?r)�initialvalue�parent)�encodingT�	I/O Error�rVzDecoding ErrorzFile %s
Failed to DecodezMixed Newlinesz:Mixed newlines detected.
The file will be changed on save.�1.0�end�insert)�tokenizer�readrW�newlines�UnicodeDecodeError�SyntaxErrorrr�updater�OSErrorr�	showerror�str�
isinstance�showwarningr@�linesep�deleterFr'�eol_conventionr\r:r6�mark_set�yview�updaterecentfileslist)	r*rC�f�charsr'rj�	converted�enc�errs	         rrNzIOBinding.loadfile{s��	�
%��]�]�8�,���F�F�H�E�#$�:�:�L�%&�Z�Z�N� %�I�	-�:�.�#�.��)��&�&�'7�*M�04�	�	�;�!�	��Z�Z�N��	�	�����&����$��(���,����	�	�����&��������(�#��
�N�N�5�!��	�	���8�U�+��	�	����!��"�"�8�,��m-�,��
'��4�
%����!�!�(�(�*��+�@�")��<�<�,�,�
.���(�S�1�Q��F�F�H�E�#$�:�:�L�%&�Z�Z�N� $�I�	2�1�1��
%���	�� � ��c�#�h�t�y�y�I���!�	�� � �!1�#>��#I�*.�)�)�
5��		�se�E2�+E%�E2�%E/�*E2�2A#H�+H	�	H�	H	�H�H�H�H�	J	�%+I�1J	�J	c�B�|j�ryd|jxsd�d�}tjd|tj|j
��}|r&|j
d�|j�rdnd}n|�dnd	}|j
j�|S)
z�Return 'yes', 'no', 'cancel' as appropriate.

        Tkinter messagebox.askyesnocancel converts these tk responses
        to True, False, None.  Convert back, as now expected elsewhere.
        �yeszDo you want to save zthis untitled documentz before closing?z
Save On Close��title�message�defaultrVNrJ�no)r4rCr�askyesnocancel�YESrr!rO)r*rw�confirmrSs    rrPzIOBinding.maybesave�s����>�>���)��m�m�?�'?�@�%�&���+�+�'�!�$�.�.����	$��
��I�I�d�O�!�^�^�-�E�8�E�#*�?�x��u��	�	�����r,c� �|js|j|�nG|j|j�r,|jd�	|jj�|jj�y#t$rY�&wxYw)NTrI)	rCr#�	writefiler6r�store_file_breaks�AttributeErrorrrO�r*rQs  rr!zIOBinding.save�so���}�}��L�L����~�~�d�m�m�,����t�$���L�L�2�2�4�	
�	�	������&����s�B�	B
�B
c�8�|j�}|rN|j|�r=|j|�|jd�	|jj�|jj�|j|�y#t$rY�7wxYw)Nr?rI)
�asksavefiler~rFr6rrr�rrOrm�r*rQrCs   rr#zIOBinding.save_as�s����#�#�%����~�~�h�'��!�!�(�+����q�!���L�L�2�2�4�	
�	�	�����"�"�8�,���	&����s�B
�
	B�Bc��|j�}|r|j|�|jj�|j	|�y)NrI)r�r~rrOrmr�s   rr%zIOBinding.save_a_copy�s@���#�#�%����N�N�8�$��	�	�����"�"�8�,�r,c��|j�}|j|�}	t|d�5}|j|�|j	�tj|j��ddd�y#1swYyxYw#t$r5}tjdt|�|j��Yd}~yd}~wwxYw)N�wbTrXrYF)
�fixnewlines�encoder�write�flushr@�fsync�filenorcrrdrer)r*rCrrorn�msgs      rr~zIOBinding.writefile�s������!�����D�!��		��h��%����������	��������$�&��	&����	�� � ��c�#�h�*.�)�)�
5���	�s5�B	�AA=�4B	�=B�B	�B	�		C�+C�Cc��t|jd�r6|jjd|jj	d��}nV|jjd�dk7r|jj
dd�|jjdd�}|jdk7r|jd|j�}|S)zYReturn text with os eols.

        Add prompts if shell else final 
 if missing.
        rHrZzend-1czend-2c�
)	�hasattrr�get_prompt_textr�index�getr\rj�replace�r*rs  rr�zIOBinding.fixnewlines�s����4�<�<��*��<�<�/�/��t�y�y���x�7P�Q�D��y�y�}�}�X�&�$�.��	�	� � ��4�0��9�9�=�=���1�D����$�&��<�<��d�&9�&9�:�D��r,c�&�t|t�r|S|jdk(r|jd�S	|jd�S#t$rYnwxYw	|jdd�}tjtj|�j�\}}|j|�S#t$r}t|�}Yd}~nd}~wt$rdz}YnwxYwtjdd|z|j��|jd�S)Nz	utf-8-sig�asciir�zInvalid encoding '%s'rXz%s.
Saving as UTF-8rY)rf�bytesr'r��UnicodeEncodeErrorr]�detect_encoding�io�BytesIO�readlinerarerrdr)r*ro�encodedrq�_rr�faileds       rr�zIOBinding.encodes����e�U�#��L�����+��<�<��,�,�	��<�<��(�(��!�	��	��	3��l�l�7�I�6�G��-�-�b�j�j��.A�.J�.J�K�F�C���<�<��$�$���	���X�F��!�	3�,�s�2�F�	3������"�V�+��9�9�	��|�|�K�(�(s0�A�	A�A�AB-�-	C�6C�C�Cc���tjddtj|j��}|s|jj	�yd}|j�}|r|j}|r�Wtjd��\}}|}tj|�|j|�stj|�ytj}d}|dk(rtjd	d
d�}	|	dz}	n|d
k(rtjd	d
d�}	nd}|r�	t!j"|�z}	tj$|	d�}
|
j'�j)�}|
j�}|rd|z|z}|r[dt+|	�z|z}tj,d||j��n'd|z}
tj.d|
|j��|rtj|�y)N�PrintzPrint to Default PrinterrurI�	IDLE_tmp_)�prefixT�posix�main�Generalzprint-command-posixz 2>&1�ntzprint-command-winF�rz#Printing failed (exit status 0x%x)
zPrinting command: %s
zPrint statusrYz-Printing is not enabled for this platform: %s)r�askokcancel�OKrrOr4rC�tempfile�mkstempr@r1r~�unlink�namer�	GetOption�shlex�quote�popenr^�strip�reprrd�showinfo)r*rQr|�tempfilename�savedrC�tfd�platform�
printPlatform�command�pipe�output�statusrws              rr(zIOBinding.print_window-s����(�(��4�$�-�-����	$��
��I�I���!������� ����}�}�H���(�"*�"2�"2�+�"F��S�,�#�H��H�H�S�M��>�>�,�/��	�	�,�'���7�7���
��w���(�(��	�)>�@�G���'�G�
��
��(�(��	�:M�N�G�!�M������H� 5�5�G��8�8�G�S�)�D��Y�Y�[�&�&�(�F��Z�Z�\�F��?�� �"(�)���1�D��M�A�F�J���$�$�^�V�D�I�I�N�E��P�G�������	�	�J���I�I�l�#�r,zPython files�TEXT)z
Text filesz*.txtr�)z	All filesr
�darwinz.py�c���|jd�\}}|js0tj|j|j
��|_|jj
||��}|S)Nr)rV�	filetypes��
initialdir�initialfile)�defaultfilename�
opendialogr�Openrr��show�r*�dir�baserCs    rrLzIOBinding.askopenfilejsY���(�(��0�	��T����(�o�o�T�Y�Y�:>�.�.�J�D�O��?�?�'�'�3�D�'�I���r,c��|jr)tjj|j�S|jr|jdfS	tj
�}|dfS#t$rd}Y|dfSwxYw)Nr�)rCr@rA�splitrD�getcwdrc)r*�mode�pwds   rr�zIOBinding.defaultfilenamersp���=�=��7�7�=�=����/�/�
�\�\��<�<��#�#�
��i�i�k����7�N���
�����7�N�
�s�A)�)A:�9A:c��|jd�\}}|js;tj|j|j
|j��|_|jj||��}|S)Nr!)rVr��defaultextensionr�)r��
savedialogr�SaveAsrr�r�r�r�s    rr�zIOBinding.asksavefile~sf���(�(��0�	��T����(�/�/��9�9�"�n�n�%)�%:�%:�<�D�O��?�?�'�'�3�D�'�I���r,c�h�|jjr|jj|�yy)z-Update recent file list on all editor windowsN)rrK�update_recent_files_listrEs  rrmzIOBinding.updaterecentfileslist�s&���<�<����L�L�1�1�(�;�r,)NN)r)%�__name__�
__module__�__qualname__r+r1r4r6r:r/r=rCrDrFrr@rhrjrNrPr!r#r%r~r�r�r(r�r�rr��sysr�r�rLr�r�rmrr,rrrs���

P�
)�(�%�"� ��)��H��G�	,�*�X�Z�Z�N�9�v�.����� )�>0�d�J��J�
���/�'��
�I�!$���� 8�u�b���
��<r,rc�h�ddlm}m}||�}|jd�t	t
|j
�jd�dd�\}}|j
d||dzfz�Gd�d	�}||�}|j�|j�||�}t|�y)
Nr)�Toplevel�TextzTest IOBinding�+r?z+%d+%d�c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�_io_binding.<locals>.MyEditWinc��||_d|_|jjd|j�|jjd|j�|jjd|j
�|jjd|j�|jjd|j�y)Nz<Control-o>z<Control-p>z<Control-s>z<Alt-s>z<Control-c>)rrKrr�printr!�saveas�savecopyr�s  rr+z'_io_binding.<locals>.MyEditWin.__init__�s~���D�I��D�J��I�I�N�N�=�$�)�)�4��I�I�N�N�=�$�*�*�5��I�I�N�N�=�$�)�)�4��I�I�N�N�9�d�k�k�2��I�I�N�N�=�$�-�-�8r,c��y)Nrrr0s rr4z(_io_binding.<locals>.MyEditWin.get_saved�s��Ar,c��yr3rr7s  rr6z(_io_binding.<locals>.MyEditWin.set_saved�s��4r,c��yr3rr0s rr:z)_io_binding.<locals>.MyEditWin.reset_undo�s��dr,c�:�|jjd�y)Nr�r�event_generater�s  rrz#_io_binding.<locals>.MyEditWin.open�s���I�I�$�$�%@�Ar,c�:�|jjd�y)Nrr�r�s  rr�z$_io_binding.<locals>.MyEditWin.print�s���I�I�$�$�%7�8r,c�:�|jjd�y)Nrr�r�s  rr!z#_io_binding.<locals>.MyEditWin.save�s���I�I�$�$�%6�7r,c�:�|jjd�y)Nrr�r�s  rr�z%_io_binding.<locals>.MyEditWin.saveas�s���I�I�$�$�%>�?r,c�:�|jjd�y)Nrr�r�s  rr�z'_io_binding.<locals>.MyEditWin.savecopy�s���I�I�$�$�%F�Gr,N)r�r�r�r+r4r6r:rr�r!r�r�rr,r�	MyEditWinr��s.��	9�	&�'�"�	B�	9�	8�	@�	Hr,r�)�tkinterr�r�rv�map�int�geometryr��packrOr)	rVr�r��top�x�yr�rrs	         r�_io_bindingr��s���&�
�6�
�C��I�I����s�F�O�O�%�+�+�C�0���4�5�D�A�q��L�L��Q��C��L�(�)�H�H�.��9�D��I�I�K��N�N����o�G�
�g�r,�__main__)r�zidlelib.idle_test.test_iomenu�F)�	verbosity�exit)�run)r�r@r�r�r�r]r�rr�tkinter.simpledialogr�idlelib.configr�idlelib.utilr�joinrWr��errorsrr�r��unittestr��idlelib.idle_test.htestrrr,r�<module>r
s���	�	��
�����*�#�&����:�M�:�:�
����L�L�G�3��9J��w<�w<�t#�L�z����	(�A�E�B�+����r,

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