Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/iomenu.cpython-37.opt-2.pyc

B

YI~d�P�@s�ddlZddlmZddlZddlZddlZddlZddlZddlmZ	ddl
mZddl
mZddlZddlmZejr�dZdZn�yddlZe�ejd�Wneejfk
r�YnXejdkr�dZdZn�ye�ej�Zer�e�e�WnXee e!fk
�rDy e�"�d	Ze�r"e�e�Wne#e!fk
�r>YnXYnXe�rZe�$�Zd
ZndZdZe�%dej&�Z'e�%d
ej&�Z(dd�Z)Gdd�d�Z*dd�Z+e,dk�r�ddl-m.Z.e.dddd�ddl/m0Z0e0e+�dS)�N)�BOM_UTF8)�	askstring)�idleConfzutf-8�surrogateescape��win32��strict�asciiz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)z^[ \t\f]*(?:[#\r\n]|$)cCs�t|t�r|�d�}n|}d|kr8|�dd�dd�}n$d|krV|�dd�dd�}n|g}x2|D]&}t�|�}|dk	rzPt�|�sbdSqbWdS|�d�}yt�	|�Wn t
k
r�t
d|��YnX|S)Nz
iso-8859-1�
��
rzUnknown encoding: )�
isinstance�bytes�decode�split�	coding_re�match�blank_re�group�codecs�lookup�LookupError)�data�linesZlst�liner�name�r�3/opt/alt/python37/lib64/python3.7/idlelib/iomenu.py�coding_specBs*	




rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdZdd
�Z	dZ
dZdd�Zd4dd�Z
dZe�e�ZejZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZdZ d'Z!e"j#d(kr�d)nd*Z$d+d,�Z%d5d.d/�Z&d0d1�Z'd2d3�Z(dS)6�	IOBindingcCsr||_|j|_|j�d|j�|_|j�d|j�|_|j�d|j�|_|j�d|j	�|_
d|_|j�d|j�|_
dS)Nz<<open-window-from-file>>z<<save-window>>z<<save-window-as-file>>z<<save-copy-of-window-as-file>>z<<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)�selfr!rrr�__init__ps

zIOBinding.__init__cCsf|j�d|j�|j�d|j�|j�d|j�|j�d|j�|j�d|j�d|_d|_d|_dS)Nz<<open-window-from-file>>z<<save-window>>z<<save-window-as-file>>z<<save-copy-of-window-as-file>>z<<print-window>>)	r"Zunbindr%r'r)r+r.r!�filename_change_hook)r/rrr�close|szIOBinding.closecCs
|j��S)N)r!�	get_saved)r/rrrr3�szIOBinding.get_savedcCs|j�|�dS)N)r!�	set_saved)r/�flagrrrr4�szIOBinding.set_savedcCs|j��dS)N)r!�
reset_undo)r/rrrr6�szIOBinding.reset_undoNcCs
||_dS)N)r1)r/�hookrrr�set_filename_change_hook�sz"IOBinding.set_filename_change_hookcCsF|rtj�|�rd|_||_n$||_d|_|�d�|jrB|��dS)Nr)�os�path�isdir�filename�dirnamer4r1)r/r<rrr�set_filename�s
zIOBinding.set_filenamecCs�|jj}|rt|s|��}n|}|r`|jrTt|jdd�sT|jsT|��rT|�||j�qp|�|�n|jrp|j�	�dS|��r�|�
�}|dkr�|j�	�dS|s�|��}n|}|r�|�|�n
|j�	�dS)N�interp�break�cancel)r!�flist�askopenfile�getattrr<r3r$�loadfiler"�	focus_set�	maybesave)r/�eventZeditFilerBr<�replyrrrr$�s6




zIOBinding.openz(\r\n)|\n|\rc	
CsBy<t|d��(}|��|��}|�d�|��}WdQRXWn8tk
rt}ztjdt|�|jd�dSd}~XYnX|�	||�\}}|dkr�tjdd||jd�dS|j
�|�}|r�|�d�|_
|j
�d|�}|j�d	d
�|�d�|j�d	|�|��|�|�|�r|�d�|j�dd	�|j�d�|�|�dS)
N�rbrz	I/O Error)�parentFzDecoding ErrorzFile %s
Failed to Decodez\nz1.0�end�insertT)r$�readline�seek�read�OSError�tkMessageBox�	showerror�strr"�_decode�eol_re�searchr�eol_convention�sub�deleter>rMr6r4Zmark_setZyview�updaterecentfileslist)	r/r<�f�	two_linesr�msg�charsZ	convertedZfirsteolrrrrE�s:





zIOBinding.loadfilec
Cs�d}|�t�rHy|dd��d�}Wntk
r8dSXd|_|dfSyt|�}WnNtk
r�}ztjdd||j	d�d}Wdd}~XYntk
r�dSX|r�yt
||�}||_|dfStk
r�YnXyt
|d	�}d|_|dfStk
�rYnXyt
|d�}d|_|dfStk
�r4YnXy>|jj	��t
d
dt|jj	d�}|�rnt
||�}d|_|d
fSttfk
�r�YnXdS)N�zutf-8)NF�BOMFzError loading the filez^The encoding '%s' is not known to this Python installation. The file may not display correctly)�title�messagerKr
zSpecify 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?)ZinitialvaluerKT)�
startswithrr�UnicodeDecodeErrorr,rrrRrSr"rTr!�updater�encoding)r/r]rr_�encrrrrrU�sh





zIOBinding._decodecCsp|��rdSd|jpd}tjd|tj|jd�}|rPd}|�d�|��sbd}n|dkr^d}nd}|j��|S)NZyesz&Do you want to save %s before closing?zthis untitled documentz
Save On Close)rbrc�defaultrKrA�no)r3r<rRZaskyesnocancelZYESr"r&rF)r/rc�confirmrIrrrrG<s&


zIOBinding.maybesavecCsZ|js|�|�n:|�|j�rL|�d�y|j��Wntk
rJYnX|j��dS)NTr@)	r<r(�	writefiler4r!�store_file_breaks�AttributeErrorr"rF)r/rHrrrr&Rs

zIOBinding.savecCsf|��}|rN|�|�rN|�|�|�d�y|j��Wntk
rLYnX|j��|�	|�dS)Nrr@)
�asksavefilerlr>r4r!rmrnr"rFr[)r/rHr<rrrr(_s




zIOBinding.save_ascCs.|��}|r|�|�|j��|�|�dS)Nr@)rorlr"rFr[)r/rHr<rrrr*ms


zIOBinding.save_a_copyc
Cs�|��}|�|�}y:t|d��&}|�|�|��t�|���WdQRXdStk
r�}zt	j
dt|�|jd�dSd}~XYnXdS)N�wbTz	I/O Error)rKF)
�fixnewlines�encoder$�write�flushr9�fsync�filenorQrRrSrTr")r/r<r"r_r\r^rrrrlus


zIOBinding.writefilecCsT|j�d�dkr*t|jd�s*|j�dd�|j�dd�}|jdkrP|�d|j�}|S)Nzend-2crr?zend-1cz1.0)r"�get�hasattrr!rMrX�replace)r/r"rrrrq�s
zIOBinding.fixnewlinesc
Cs�t|t�r|S|jdkr&t|�d�Sy
|�d�Stk
rDYnXyt|�}d}Wn*tk
r�}z|}d}Wdd}~XYn
X|s�d}|r�y
|�|�Stk
r�d|}YnXtj	dd||j
d�t|�d�S)Nrazutf-8r
zInvalid encoding '%s'z	I/O Errorz%s.
Saving as UTF-8)rK)rrr,rrr�UnicodeErrorrrrRrSr")r/r_rhZfailedr^rrrrr�s4




zIOBinding.encodecCsdtjddtj|jd�}|s(|j��dSd}|��}|r>|j}|rJ|dkr�tjdd�\}}|}t	�
|�|�|�s�t	�|�dSt	j
}d}|dkr�t�d	d
d�}	|	d}	n|d
kr�t�d	d
d�}	nd}|�r6|	t�|�}	t	�|	d�}
|
����}|
�
�}|�rd||}|�rPdt|	�|}tjd||jd�nd|}
tjd|
|jd�|�r`t	�|�dS)NZPrintzPrint to Default Printer)rbrcrirKr@Z	IDLE_tmp_)�prefixT�posix�mainZGeneralzprint-command-posixz 2>&1�ntzprint-command-winF�rz#Printing failed (exit status 0x%x)
zPrinting command: %s
zPrint status)rKz-Printing is not enabled for this platform: %s)rRZaskokcancelZOKr"rFr3r<�tempfileZmkstempr9r2rl�unlinkrrZ	GetOption�shlexZquote�popenrP�strip�reprrSZshowinfo)r/rHrkZtempfilenameZsavedr<Ztfd�platformZ
printPlatformZcommand�pipe�output�statusrcrrrr-�sX







zIOBinding.print_window))zPython filesz
*.py *.pyw�TEXT)z
Text filesz*.txtr�)z	All files�*�darwinz.pyrcCs<|�d�\}}|js(tj|j|jd�|_|jj||d�}|S)Nr$)rK�	filetypes)�
initialdir�initialfile)�defaultfilename�
opendialog�tkFileDialogZOpenr"r��show)r/�dir�baser<rrrrC�szIOBinding.askopenfiler$cCsV|jrtj�|j�S|jr$|jdfSyt��}Wntk
rHd}YnX|dfSdS)Nr)r<r9r:rr=�getcwdrQ)r/�mode�pwdrrrr��s

zIOBinding.defaultfilenamecCs@|�d�\}}|js,tj|j|j|jd�|_|jj||d�}|S)Nr&)rKr��defaultextension)r�r�)r��
savedialogr�ZSaveAsr"r�r�r�)r/r�r�r<rrrroszIOBinding.asksavefilecCs|jjr|j�|�dS)N)r!rBZupdate_recent_files_list)r/r<rrrr[szIOBinding.updaterecentfileslist)NN)r$))�__name__�
__module__�__qualname__r0r2r3r4r6r1r8r<r=r>r$Zeol�re�compilerVr9�lineseprXrErUrGr&r(r*rlrqrrr-r�r�r��sysr�r�rCr�ror[rrrrr ks@
,
$D

'2

r c	Cs�ddlm}m}||�}|�d�tt|���d�dd��\}}|�d||df�Gdd	�d	�}||�}|��|�	�||�}t
|�dS)
Nr)�Toplevel�TextzTest IOBinding�+rz+%d+%d�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)z_io_binding.<locals>.MyEditWincSs`||_d|_|j�d|j�|j�d|j�|j�d|j�|j�d|j�|j�d|j�dS)Nz<Control-o>z<Control-p>z<Control-s>z<Alt-s>z<Control-c>)r"rBr#r$�printr&�saveas�savecopy)r/r"rrrr0sz'_io_binding.<locals>.MyEditWin.__init__cSsdS)Nrr)r/rrrr3$�z(_io_binding.<locals>.MyEditWin.get_savedcSsdS)Nr)r/r5rrrr4%r�z(_io_binding.<locals>.MyEditWin.set_savedcSsdS)Nr)r/rrrr6&r�z)_io_binding.<locals>.MyEditWin.reset_undocSs|j�d�dS)Nz<<open-window-from-file>>)r"�event_generate)r/rHrrrr$'sz#_io_binding.<locals>.MyEditWin.opencSs|j�d�dS)Nz<<print-window>>)r"r�)r/rHrrrr�)sz$_io_binding.<locals>.MyEditWin.printcSs|j�d�dS)Nz<<save-window>>)r"r�)r/rHrrrr&+sz#_io_binding.<locals>.MyEditWin.savecSs|j�d�dS)Nz<<save-window-as-file>>)r"r�)r/rHrrrr�-sz%_io_binding.<locals>.MyEditWin.saveascSs|j�d�dS)Nz<<save-copy-of-window-as-file>>)r"r�)r/rHrrrr�/sz'_io_binding.<locals>.MyEditWin.savecopyN)r�r�r�r0r3r4r6r$r�r&r�r�rrrr�	MyEditWinsr�)Ztkinterr�r�rb�map�intZgeometryr�packrFr )	rKr�r��root�x�yr�r"r!rrr�_io_bindings
 r��__main__)r}zidlelib.idle_test.test_iomenurF)�	verbosity�exit)�run)1rrr9r�r�r�r�Ztkinter.filedialogZ
filedialogr�Ztkinter.messageboxZ
messageboxrRZtkinter.simpledialogrZidlelibZidlelib.configrZtestingrg�errors�locale�	setlocale�LC_CTYPE�ImportError�Errorr��nl_langinfo�CODESETZlocale_encodingr�	NameErrorrnr�getdefaultlocale�
ValueError�lowerr��ASCIIrrrr r�r�Zunittestr}Zidlelib.idle_test.htestr�rrrr�<module>sf
),$


Hacked By AnonymousFox1.0, Coded By AnonymousFox