• File: iomenu.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/iomenu.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 13.46 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

NjP@sddlZddlmZddlZddlZddlZddlZddlZddlmZ	ddl
mZddl
mZddlZddlmZejrdZdZnyddlZeejdWneejfk
rYnXejdkrdZdZnyeejZereeWnXee e!fk
rDy e"d	Zer"eeWne#e!fk
r>YnXYnXerZe$Zd
ZndZdZe%dej&Z'e%d
ej&Z(ddZ)GdddZ*ddZ+e,dkrddl-m.Z.e.ddddddl/m0Z0e0e+dS)N)BOM_UTF8)	askstring)idleConfzutf-8surrogateescapeZwin32strictasciiz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)z^[ \t\f]*(?:[#\r\n]|$)cCst|tr|d}n|}d|kr8|dddd}n$d|krV|dddd}n|g}x2|D]&}t|}|dk	rzPt|sbdSqbWdS|d}yt	|Wn t
k
rt
d|YnX|S)aVReturn the encoding declaration according to PEP 263.

    When checking encoded data, only the first two lines should be passed
    in to avoid a UnicodeDecodeError if the rest of the data is not unicode.
    The first two lines would contain the encoding specification.

    Raise a LookupError if the encoding is declared but unknown.
    z
iso-8859-1
N
rzUnknown encoding: )
isinstancebytesdecodesplit	coding_rematchblank_regroupcodecslookupLookupError)datalinesZlstlinernamer3/opt/alt/python37/lib64/python3.7/idlelib/iomenu.pycoding_specBs*	




rc@seZdZddZddZddZddZd	d
ZdZdd
Z	dZ
dZddZd4ddZ
dZeeZejZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZdZdZ d'Z!e"j#d(krd)nd*Z$d+d,Z%d5d.d/Z&d0d1Z'd2d3Z(dS)6	IOBindingcCsr||_|j|_|jd|j|_|jd|j|_|jd|j|_|jd|j	|_
d|_|jd|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>>)editwintextbindopen_IOBinding__id_opensave_IOBinding__id_savesave_as_IOBinding__id_saveassave_a_copy_IOBinding__id_savecopyfileencodingprint_window_IOBinding__id_print)selfr rrr__init__ps

zIOBinding.__init__cCsf|jd|j|jd|j|jd|j|jd|j|jd|jd|_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.rrrclose|szIOBinding.closecCs
|jS)N)r 	get_saved)r.rrrr2szIOBinding.get_savedcCs|j|dS)N)r 	set_saved)r.flagrrrr3szIOBinding.set_savedcCs|jdS)N)r 
reset_undo)r.rrrr5szIOBinding.reset_undoNcCs
||_dS)N)r0)r.hookrrrset_filename_change_hooksz"IOBinding.set_filename_change_hookcCsF|rtj|rd|_||_n$||_d|_|d|jrB|dS)Nr)ospathisdirfilenamedirnamer3r0)r.r;rrrset_filenames
zIOBinding.set_filenamecCs|jj}|rt|s|}n|}|r`|jrTt|jddsT|jsT|rT|||jqp||n|jrp|j	dS|r|
}|dkr|j	dS|s|}n|}|r||n
|j	dS)Ninterpbreakcancel)r flistaskopenfilegetattrr;r2r#loadfiler!	focus_set	maybesave)r.eventZeditFilerAr;replyrrrr#s6




zIOBinding.openz(\r\n)|\n|\rc	
CsBy<t|d(}||}|d|}WdQRXWn8tk
rt}ztjdt||jddSd}~XYnX|	||\}}|dkrtjdd||jddS|j
|}|r|d|_
|j
d|}|jd	d
|d|jd	|||||r|d|jdd	|jd||dS)
Nrbrz	I/O Error)parentFzDecoding ErrorzFile %s
Failed to Decodez\nz1.0endinsertT)r#readlineseekreadOSErrortkMessageBox	showerrorstrr!_decodeeol_researchreol_conventionsubdeleter=rLr5r3Zmark_setZyviewupdaterecentfileslist)	r.r;f	two_linesrmsgcharsZ	convertedZfirsteolrrrrDs:





zIOBinding.loadfilec
Csd}|trHy|ddd}Wntk
r8dSXd|_|dfSyt|}WnNtk
r}ztjdd||j	d	d}Wdd}~XYntk
rdSX|ryt
||}||_|dfStk
rYnXyt
|d
}d|_|dfStk
rYnXyt
|d}d|_|dfStk
r4YnXy>|jj	t
ddt|jj	d
}|rnt
||}d|_|dfSttfk
rYnXdS)zCreate a Unicode string.Nzutf-8)NFBOMFzError loading the filez^The encoding '%s' is not known to this Python installation. The file may not display correctly)titlemessagerJr	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initialvaluerJT)
startswithrrUnicodeDecodeErrorr+rrrQrRr!rSr updaterencoding)r.r\rr^encrrrrrTsh





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)rarbdefaultrJr@Zno)r2r;rQZaskyesnocancelZYESr!r%rE)r.rbconfirmrHrrrrF<s&


zIOBinding.maybesavecCsZ|js||n:||jrL|dy|jWntk
rJYnX|jdS)NTr?)	r;r'	writefiler3r store_file_breaksAttributeErrorr!rE)r.rGrrrr%Rs

zIOBinding.savecCsf|}|rN||rN|||dy|jWntk
rLYnX|j|	|dS)Nrr?)
asksavefilerjr=r3r rkrlr!rErZ)r.rGr;rrrr'_s




zIOBinding.save_ascCs.|}|r|||j||dS)Nr?)rmrjr!rErZ)r.rGr;rrrr)ms


zIOBinding.save_a_copyc
Cs|}||}y:t|d&}|||t|WdQRXdStk
r}zt	j
dt||jddSd}~XYnXdS)NwbTz	I/O Error)rJF)
fixnewlinesencoder#writeflushr8fsyncfilenorPrQrRrSr!)r.r;r!r^r[r]rrrrjus


zIOBinding.writefilecCsT|jddkr*t|jds*|jdd|jdd}|jdkrP|d|j}|S)z/Return text with final 
 if needed and os eols.zend-2cr
r>zend-1cz1.0)r!gethasattrr rLrWreplace)r.r!rrrros
zIOBinding.fixnewlinesc
Cst|tr|S|jdkr&t|dSy
|dStk
rDYnXyt|}d}Wn*tk
r}z|}d}Wdd}~XYn
X|sd}|ry
||Stk
rd|}YnXtj	dd||j
dt|dS)Nr`zutf-8r	zInvalid encoding '%s'z	I/O Errorz%s.
Saving as UTF-8)rJ)r
rr+rrpUnicodeErrorrrrQrRr!)r.r^rgZfailedr]rrrrps4




zIOBinding.encodecCsdtjddtj|jd}|s(|jdSd}|}|r>|j}|rJ|dkrtjdd\}}|}t	
|||st	|dSt	j
}d}|dkrtd	d
d}	|	d}	n|d
krtd	d
d}	nd}|r6|	t|}	t	|	d}
|
}|

}|rd||}|rPdt|	|}tjd||jdnd|}
tjd|
|jd|r`t	|dS)NZPrintzPrint to Default Printer)rarbrhrJr?Z	IDLE_tmp_)prefixTposixmainZGeneralzprint-command-posixz 2>&1ntzprint-command-winFrz#Printing failed (exit status 0x%x)
zPrinting command: %s
zPrint status)rJz-Printing is not enabled for this platform: %s)rQZaskokcancelZOKr!rEr2r;tempfileZmkstempr8r1rjunlinkrrZ	GetOptionshlexZquotepopenrOstripreprrRZshowinfo)r.rGriZtempfilenameZsavedr;ZtfdplatformZ
printPlatformZcommandpipeoutputZstatusrbrrrr,sX







zIOBinding.print_window))zPython filesz
*.py *.pywTEXT)z
Text filesz*.txtr)z	All files*darwinz.pyrcCs<|d\}}|js(tj|j|jd|_|jj||d}|S)Nr#)rJ	filetypes)
initialdirinitialfile)defaultfilename
opendialogtkFileDialogZOpenr!rshow)r.dirbaser;rrrrBszIOBinding.askopenfiler#cCsV|jrtj|jS|jr$|jdfSyt}Wntk
rHd}YnX|dfSdS)Nr)r;r8r9rr<getcwdrP)r.modepwdrrrrs

zIOBinding.defaultfilenamecCs@|d\}}|js,tj|j|j|jd|_|jj||d}|S)Nr%)rJrdefaultextension)rr)r
savedialogrZSaveAsr!rrr)r.rrr;rrrrmszIOBinding.asksavefilecCs|jjr|j|dS)z-Update recent file list on all editor windowsN)r rAZupdate_recent_files_list)r.r;rrrrZszIOBinding.updaterecentfileslist)NN)r#))__name__
__module____qualname__r/r1r2r3r5r0r7r;r<r=r#ZeolrecompilerUr8lineseprWrDrTrFr%r'r)rjrorpr,rrrsysrrrBrrmrZrrrrrks@
,
$D

'2

rc	Csddlm}m}||}|dtt|ddd\}}|d||dfGdd	d	}||}||	||}t
|dS)
Nr)ToplevelTextzTest IOBinding+rz+%d+%dc@sTeZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZdS)z_io_binding.<locals>.MyEditWincSs`||_d|_|jd|j|jd|j|jd|j|jd|j|jd|jdS)Nz<Control-o>z<Control-p>z<Control-s>z<Alt-s>z<Control-c>)r!rAr"r#printr%saveassavecopy)r.r!rrrr/sz'_io_binding.<locals>.MyEditWin.__init__cSsdS)Nrr)r.rrrr2$z(_io_binding.<locals>.MyEditWin.get_savedcSsdS)Nr)r.r4rrrr3%rz(_io_binding.<locals>.MyEditWin.set_savedcSsdS)Nr)r.rrrr5&rz)_io_binding.<locals>.MyEditWin.reset_undocSs|jddS)Nz<<open-window-from-file>>)r!event_generate)r.rGrrrr#'sz#_io_binding.<locals>.MyEditWin.opencSs|jddS)Nz<<print-window>>)r!r)r.rGrrrr)sz$_io_binding.<locals>.MyEditWin.printcSs|jddS)Nz<<save-window>>)r!r)r.rGrrrr%+sz#_io_binding.<locals>.MyEditWin.savecSs|jddS)Nz<<save-window-as-file>>)r!r)r.rGrrrr-sz%_io_binding.<locals>.MyEditWin.saveascSs|jddS)Nz<<save-copy-of-window-as-file>>)r!r)r.rGrrrr/sz'_io_binding.<locals>.MyEditWin.savecopyN)rrrr/r2r3r5r#rr%rrrrrr	MyEditWinsr)ZtkinterrrramapintZgeometryrZpackrEr)	rJrrrootxyrr!r rrr_io_bindings
 r__main__)r{zidlelib.idle_test.test_iomenurF)	verbosityexit)run)1rrr8rrrr~Ztkinter.filedialogZ
filedialogrZtkinter.messageboxZ
messageboxrQZtkinter.simpledialogrZidlelibZidlelib.configrZtestingrferrorsZlocale	setlocaleLC_CTYPEImportErrorErrorrnl_langinfoCODESETZlocale_encodingr	NameErrorrlrZgetdefaultlocale
ValueErrorlowerrASCIIrrrrrrZunittestr{Zidlelib.idle_test.htestrrrrr<module>sf
),$