AlkantarClanX12

Your IP : 18.116.14.12


Current Path : /opt/alt/python27/lib64/python2.7/idlelib/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyc

�
^
bc@s�ddlZddlmZddlZddlZddlZddlZddlZddlTddlZddl	Z	ddl
m
Z
ddlmZy#ddl
Z
e
je
jd�Wnee
jfk
r�nXej�ZdZejdkr3y!e
j�d	Zeje�Wnek
r/nXn�yDe
je
j�Zeekp]edkridZneje�Wnveeefk
r�yBe
j�d	Zeekp�edkr�dZneje�Wneefk
r�nXnXej�Zej d
�Z!ej d�Z"de
fd
��YZ#d�Z$dfd��YZ%d�Z&e'dkr~ddl(m)Z)e)e&�ndS(i����N(tBOM_UTF8(t*(tSimpleDialog(tidleConfttasciitwin32is&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)tEncodingMessagecBs)eZdZd�Zd�Zd�ZRS(s3Inform user that an encoding declaration is needed.c
Cs�t|_t|�|_}|jd|j�|jd|j�|jd|j�|j	d�|j
d�||_t|dd�}|j
dtdt�t|d	d
�}|jdd|�|j
dtdtd
t�t|dd|�}|j
dtdt�t|�}|j
dtd
t�d|_|_t|ddddd|j�}|j
dtd
tdd�t|ddd|j�}	|	j
dtd
tdd�|j|�dS(Ns<Return>s<Escape>tWM_DELETE_WINDOWsI/O Warningttexts:Non-ASCII found, yet no encoding declared. Add a line liketsidetanchortfonttcourieris# -*- coding: %s -*-tfills�to your file
See Language Reference, 2.1.4 Encoding declarations.
Choose OK to save this file as %s
Edit your general options to silence this warningtOktdefaulttactivetcommandtexpandisEdit my file(tFalsetshould_edittTopleveltroottbindtreturn_eventtdo_oktprotocoltwm_delete_windowtwm_titletwm_iconnamettoptLabeltpacktTOPtWtEntrytinserttXtFrameRtcanceltButtontLEFTtBOTHtdo_editt_set_transient(
tselftmastertencRtl1tl2tl3tbuttonstb1tb2((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyt__init__Js6	

			
cCs|jd�dS(Ni(tdone(R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRqscCs|jd�dS(Ni(R8(R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR,ts(t__name__t
__module__t__doc__R7RR,(((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRHs	'	cCs�|jdd�d }xD|D]8}tj|�}|dk	rBPntj|�sdSqWdS|jd�}ddl}y|j|�Wntk
r�td|�nX|S(szReturn the encoding declaration according to PEP 263.

    Raise LookupError if the encoding is declared but unknown.
    s
iii����NsUnknown encoding (	tsplitt	coding_retmatchtNonetblank_retgrouptcodecstlookuptLookupError(tstrtlsttlineR>tnameRB((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pytcoding_specws

t	IOBindingcBs=eZd�Zd�Zd�Zd�Zd�Zd"Zd�Z	d"Z
d"Zd�Zd"d"d�Z
dZeje�ZejZd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd"Zd"Z d#d$d%gZ!e"j#dkrdndZ$d�Z%dd�Z&d �Z'd!�Z(RS(&cCs�||_|j|_|jjd|j�|_|jjd|j�|_|jjd|j�|_|jjd|j	�|_
d|_|jjd|j
�|_dS(Ns<<open-window-from-file>>s<<save-window>>s<<save-window-as-file>>s<<save-copy-of-window-as-file>>s<<print-window>>(teditwinR	Rtopent_IOBinding__id_opentsavet_IOBinding__id_savetsave_ast_IOBinding__id_saveastsave_a_copyt_IOBinding__id_savecopyR?tfileencodingtprint_windowt_IOBinding__id_print(R.RK((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR7�s		cCs�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�d|_d|_d|_	dS(Ns<<open-window-from-file>>s<<save-window>>s<<save-window-as-file>>s<<save-copy-of-window-as-file>>s<<print-window>>(
R	tunbindRMRORQRSRVR?RKtfilename_change_hook(R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pytclose�s		cCs
|jj�S(N(RKt	get_saved(R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRZ�scCs|jj|�dS(N(RKt	set_saved(R.tflag((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR[�scCs|jj�dS(N(RKt
reset_undo(R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR]�scCs
||_dS(N(RX(R.thook((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pytset_filename_change_hook�scCsf|r-tjj|�r-d|_||_n5||_d|_|jd�|jrb|j�ndS(Ni(tostpathtisdirR?tfilenametdirnameR[RX(R.Rc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pytset_filename�s			
	cCs%|jj}|r�|s'|j�}n|}|r�|jr~t|jdd�r~|jr~|j�r~|j||j�q�|j|�n|j	r�|j	j
�ndS|j�r�|j�}|dkr�|j	j
�dSn|s�|j�}n|}|r|j|�n
|j	j
�dS(NtinterptbreakR((RKtflisttaskopenfiletgetattrR?RcRZRLtloadfileR	t	focus_sett	maybesave(R.teventteditFileRhRctreply((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRL�s6	
	

s(\r\n)|\n|\rcCsWy(t|d��}|j�}WdQXWn3tk
r]}tjdt|�d|j�tSX|j|�}|j	j
|�}|r�|jd�|_t
|jt�r�|jjd�|_n|j	jd|�}n|jjdd�|jd�|jjd|�|j�|j|�|jjd	d�|jjd	�|j|�tS(
Ntrbs	I/O ErrortparentiRs\ns1.0tendR%(RLtreadtIOErrorttkMessageBoxt	showerrorRER	Rtdecodeteol_retsearchRAteol_conventiont
isinstancetunicodetencodetsubtdeleteReR?R%R]tmark_settyviewtupdaterecentfileslisttTrue(R.Rctftcharstmsgtfirsteol((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRk�s,



cCs!|jt�rKy|djd�}Wntk
r:|SXt|_|Snyt|�}Wn<tk
r�}tjdddd|d|j	�d	}nX|r�yt||�SWq�tk
r�q�Xnyt|d�SWntk
r�nXyt|t�}t|_Wntk
rnX|S(
sMCreate a Unicode string

        If that fails, let Tcl try its best
        isutf-8ttitlesError loading the filetmessages^The encoding '%s' is not known to this Python installation. The file may not display correctlyRrRN(
t
startswithRRxtUnicodeErrorRTRIRDRvRwR	R?R}tencoding(R.R�R0RH((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRxs>
		





c	Cs�|j�rdSd|jpd}tjddd|dtjd|j�}|r~d}|jd�|j�s�d	}q�n|dkr�d	}nd
}|jj�|S(Ntyess&Do you want to save %s before closing?sthis untitled documentR�s
Save On CloseR�RRrR(tno(	RZRcRvtaskyesnocanceltYESR	RNR?Rl(R.R�tconfirmRp((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRmAs&		
	
cCsq|js|j|�nG|j|j�r`|jt�y|jj�Wq`tk
r\q`Xn|jj	�dS(NRg(
RcRPt	writefileR[R�RKtstore_file_breakstAttributeErrorR	Rl(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRNWs	


cCs�|j�}|rf|j|�rf|j|�|jd�y|jj�Wqctk
r_qcXqfn|jj�|j	|�dS(NiRg(
tasksavefileR�ReR[RKR�R�R	RlR�(R.RnRc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRPds





cCs@|j�}|r"|j|�n|jj�|j|�dS(NRg(R�R�R	RlR�(R.RnRc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRRrs

cCs�|j�|j|jjdd��}|jdkrO|jd|j�}nyJt|d��1}|j|�|j�t	j
|j��WdQXtSWn3t
k
r�}tjdt|�d|j�tSXdS(Ns1.0send-1cs
twbs	I/O ErrorRr(tfixlastlineR~R	tgetR{treplaceRLtwritetflushR`tfsynctfilenoR�RuRvRwRER(R.RcR�R�R�((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�zs



c
Cs�t|t�r|Sy|jd�SWntk
r7nXyt|�}d}Wntk
ro}|}d}nX|r�y|j|�SWq�tk
r�d|}q�Xn|r�tjdd|d|j	�n|j
tks�|r�t|jd�S|j
rVy|j|j
�SWqVtk
rRtjdd|j
d|j	�t|jd�SXntj
dd	d
�}|dkr�t|jd�St}y.|jt�}t}|dkr�t}nWn*tk
r�t|jd�}d}nX|s�|St|jj|�}|j�|jdkr�d
|}|j	jdd�}	|	jd�re|j	jd|�n|j	jd|�|j|j	jdd��S|S(NRsInvalid encoding '%s's	I/O Errors%s. Saving as UTF-8Rrsutf-8s1Cannot save this as '%s' anymore. Saving as UTF-8tmaintEditorWindowR�tlocaleis# -*- coding: %s -*-
s1.0s2.0s#!send-1c(R|RER~R�RIR?RDRvRwR	RTRRt	GetOptionR�R�RRRKRtgotnumR�R�R%(
R.R�R0tfailedR�tconfig_encodingtask_usertdialogtenclinet	firstline((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR~�sv





	


	




cCs8|jjd�}|dkr4|jjdd�ndS(Nsend-2cs
send-1c(R	R�R%(R.tc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR��sc	Cstjdddddtjd|j�}|sA|jj�dSd}|j�}|re|j}n|sx|dkr�tj	dd	�\}}|}t
j|�|j|�s�t
j
|�dSnt
j}t}|d
krtjddd
�}	|	d}	n*|dkr'tjddd�}	nt}|r�|	tj|�}	t
j|	d�}
|
j�j�}|
j�}|r�d||}n|r�dt|	�|}tjd|d|j�q�n#d|}
tjd|
d|j�|r�t
j
|�ndS(NR�tPrintR�sPrint to Default PrinterRRrRgtprefixt	IDLE_tmp_tposixR�tGeneralsprint-command-posixs 2>&1tntsprint-command-wintrs#Printing failed (exit status 0x%x)
sPrinting command: %s
sPrint statuss-Printing is not enabled for this platform: %s(RvtaskokcanceltOKR	RlR?RZRcttempfiletmkstempR`RYR�tunlinkRHR�RR�RtpipestquotetpopenRttstriptreprRwtshowinfo(R.RnR�ttempfilenametsavedRcttfdtplatformt
printPlatformRtpipetoutputtstatusR�((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRU�sX		


		

sPython filess
*.py *.pywtTEXTs
Text filess*.txts	All filesRtdarwins.pyRcCs�|jd�\}}|jsBtjd|jd|j�|_n|jjd|d|�}t|t�r~|j	t
�}n|S(NRLRrt	filetypest
initialdirtinitialfile(tdefaultfilenamet
opendialogttkFileDialogtOpenR	R�tshowR|R}R~tfilesystemencoding(R.tdirtbaseRc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRis	RLcCsm|jrtjj|j�S|jr2|jdfSytj�}Wntjk
r^d}nX|dfSdS(NR(RcR`RaR<Rdtgetcwdterror(R.tmodetpwd((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR� s		

cCs�|jd�\}}|jsKtjd|jd|jd|j�|_n|jjd|d|�}t|t	�r�|j
t�}n|S(NRNRrR�tdefaultextensionR�R�(R�t
savedialogR�tSaveAsR	R�R�R�R|R}R~R�(R.R�R�Rc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�,s				cCs|jj|�dS(s-Update recent file list on all editor windowsN(RKtupdate_recent_files_list(R.Rc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�8sN(sPython filess
*.py *.pywR�(s
Text filess*.txtR�(s	All filesR()R9R:R7RYRZR[R]R?RXR_RcRdReRLteoltretcompileRyR`tlinesepR{RkRxRmRNRPRRR�R~R�RUR�R�R�tsysR�R�RiR�R�R�(((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRJ�sD							,			-		
				J		2		
	cCs�ddlm}m}||�}|jd�ttttjd|j	����\}}}}|j	d||df�dd	d��Y}||�}	|	j
�|	j�||	�}
t|
�dS(
Ni����(RtTextsTest IOBindings[x+]s+%d+%di�t	MyEditWincBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cSs�||_d|_|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�dS(Ns<Control-o>s<Control-p>s<Control-s>s<Alt-s>s<Control-c>(	R	R?RhRRLtprinterRNtsaveastsavecopy(R.R	((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR7Es		cSsdS(Ni((R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRZMRcSsdS(N((R.R\((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR[NRcSsdS(N((R.((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR]ORcSsdS(N((R.Rc((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�PRcSs|jjd�dS(Ns<<open-window-from-file>>(R	tevent_generate(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRLQscSs|jjd�dS(Ns<<print-window>>(R	R�(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�SscSs|jjd�dS(Ns<<save-window>>(R	R�(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyRNUscSs|jjd�dS(Ns<<save-window-as-file>>(R	R�(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�WscSs|jjd�dS(Ns<<save-copy-of-window-as-file>>(R	R�(R.Rn((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�Ys(R9R:R7RZR[R]R�RLR�RNR�R�(((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyR�Ds									((
tTkinterRR�R�tlisttmaptintR�R<tgeometryR!RlRJ(RrRR�RtwidththeighttxtyR�R	RK((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyt_io_binding=s
3

t__main__(trun(*RBRR`R�R�R�R�R�R�RvRtidlelib.configHandlerRR�t	setlocaletLC_CTYPEtImportErrortErrortgetfilesystemencodingR�R�R�tgetdefaultlocaleRCRDtnl_langinfotCODESETR?t	NameErrorR�t
ValueErrortlowerR�R=R@RRIRJR�R9tidlelib.idle_test.htestR�(((s6/opt/alt/python27/lib64/python2.7/idlelib/IOBinding.pyt<module>s`

		/	��	%