+
     Bi?                     :   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt RP                  R ] 4       4      tR	t]P"                  R
8X  d   RMRt ! R R4      tR t]R8X  d"   ^ RIHt ]! R^RR7       ^ RIHt ]! ]4       R# R# )    N)
filedialog)
messagebox)	askstring)idleConf)py_extensions c              #   4   "   T F  pR V,           x  K  	  R# 5i)*N ).0exts   & %/usr/lib/python3.14/idlelib/iomenu.py	<genexpr>r      s     :MSSMs   utf-8win32surrogatepasssurrogateescapec                     a  ] tR t^t o R tR tR tR tR tRt	R t
RtRtR tRR	 lt]P                   tR
 tR tR tR tR tR tR tR tR tRtRtR]R3RR3t]P@                  R8X  d   RMRt!R t"R R lt#R t$R t%Rt&V t'R# )!	IOBindingc                   Wn         VP                  V n        V P                  P                  R V P                  4      V n        V P                  P                  RV P
                  4      V n        V P                  P                  RV P                  4      V n        V P                  P                  RV P                  4      V n
        RV n        V P                  P                  RV P                  4      V n        R# )<<open-window-from-file>><<save-window>><<save-window-as-file>><<save-copy-of-window-as-file>>r   <<print-window>>N)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   s   &&r   __init__IOBinding.__init__   s    LL	(CTYYO(9499E99>>*C*.,,8!YY^^,M,0,<,<>#))..);T=N=NO    c                   V P                   P                  R V P                  4       V P                   P                  RV P                  4       V P                   P                  RV P                  4       V P                   P                  RV P
                  4       V P                   P                  RV P                  4       RV n        RV n         RV n        R# )r   r   r   r   r   N)	r   unbindr    r"   r$   r&   r)   r   filename_change_hookr*   s   &r   closeIOBinding.close%   s    		4dnnE		*DNN;		243C3CD		:D<N<NO		+T__=	$(!r-   c                6    V P                   P                  4       # N)r   	get_savedr1   s   &r   r6   IOBinding.get_saved1   s    ||%%''r-   c                <    V P                   P                  V4       R # r5   )r   	set_savedr*   flags   &&r   r9   IOBinding.set_saved4   s    t$r-   c                :    V P                   P                  4        R # r5   )r   
reset_undor1   s   &r   r>   IOBinding.reset_undo7   s    !r-   Nc                    Wn         R # r5   )r0   )r*   hooks   &&r   set_filename_change_hook"IOBinding.set_filename_change_hook<   s    $(!r-   c                   V'       d5   \         P                  P                  V4      '       d   R V n        Wn        R # Wn        R V n        V P                  ^4       V P                  '       d   V P                  4        R # R # r5   )ospathisdirfilenamedirnamer9   r0   r*   rH   s   &&r   set_filenameIOBinding.set_filenameB   sX    h// DM#L$MDLNN1((())+ )r-   c                &   V P                   P                  pV'       d   V'       g   V P                  4       pMTpV'       d   V P                   '       dc   \        V P                   R R4      '       gF   V P                  '       g4   V P                  4       '       d   VP                  W@P                  4       R# VP                  V4        R# V P                  '       d   V P                  P                  4        R# V P                  4       '       d4   V P                  4       pVR8X  d   V P                  P                  4        R# V'       g   V P                  4       pMTpV'       d   V P                  V4       R# V P                  P                  4        R# )interpNbreakcancel)r   flistaskopenfilegetattrrH   r6   r   loadfiler   	focus_set	maybesave)r*   eventeditFilerQ   rH   replys   &&&   r   r   IOBinding.openM   s   ""++-! LLL#DLL(DAA MMM((JJx7 	 JJx(  999II'') >>NN$E 		##%'')HHMM(#  II!r-   c                     \         P                  ! V4      ;_uu_ 4       pVP                  4       pVP                  pVP                  pR pRRR4       \        X\        4      '       g:   Te&   \        P                   ! RRT P                  R	7       Rp\"        P$                  pT P                  P'                  RR4       T P)                  R4       XT n        YPn        T P                  P/                  RX4       T P1                  4        T P)                  T4       X'       d   T P3                  R 4       T P                  P5                  RR4       T P                  P7                  R4       T P9                  T4       R#   + '       g   i     EL:; i  \
        \        3 d    T P                  P                  P                  4        \        RRRT P                  P                  R7      p\        YR7      ;_uu_ 4       pTP                  4       pTP                  pTP                  pRpRRR4        EK    + '       g   i      EL; ii ; i  \         d8   p\        P                  ! R\        T4      T P                  R	7        Rp?R # Rp?i\
         d/    \        P                  ! R
RT,          T P                  R	7        R # i ; i)FNzSpecify 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r]   zDecoding ErrorzFile %s
Failed to DecodezMixed Newlinesz:Mixed newlines detected.
The file will be changed on save.1.0endinsert)tokenizer   readr^   newlinesUnicodeDecodeErrorSyntaxErrorr   r   updater   OSErrorr   	showerrorstr
isinstanceshowwarningrE   linesepdeleterK   r'   eol_conventionrc   r>   r9   mark_setyviewupdaterecentfileslist)	r*   rH   fcharsr'   rq   	convertedencerrs	   &&       r   rT   IOBinding.loadfile{   s#   	%]]8,,FFHE#$::L%&ZZN %I	 -: .#.. )&&'7*M04		; !	ZZN		&$(,		&(# NN5!		8U+		!""8,m -,,
 '4 %!!((*+@ ")<<,,. (11QFFHE#$::L%&ZZN $I	 2111%  	  c#htyyI! 	  !1#>#I*.))5 		sw   F +E=F =F	F F A,I
=+H4(I
0I 4I?I
I I

I K,J

K+KKc                z   V P                  4       '       d   R# RV P                  ;'       g    R R2p\        P                  ! RV\        P                  V P
                  R7      pV'       d-   V P                  R4       V P                  4       '       d   RMRpMVf   RMR	pV P
                  P                  4        V# )
zReturn 'yes', 'no', 'cancel' as appropriate.

Tkinter messagebox.askyesnocancel converts these tk responses
to True, False, None.  Convert back, as now expected elsewhere.
yeszDo you want to save zthis untitled documentz before closing?zSave On Closetitlemessagedefaultr]   NrP   no)r6   rH   r   askyesnocancelYESr   r!   rU   )r*   r   confirmrY   s   &   r   rV   IOBinding.maybesave   s     >>)mm??'?@%& ++'!$..	$
 IIdO!^^--E8E#*?xu		r-   c                >   V P                   '       g   V P                  V4       MMV P                  V P                   4      '       d-   V P                  R 4        V P                  P                  4        V P                  P                  4        R#   \         d     L)i ; i)TrO   )	rH   r#   	writefiler9   r   store_file_breaksAttributeErrorr   rU   r*   rW   s   &&r   r!   IOBinding.save   st    }}}LL~~dmm,,t$LL224 			 & s   B BBc                V   V P                  4       pV'       dU   V P                  V4      '       d>   V P                  V4       V P                  ^4        V P                  P                  4        V P                  P                  4        V P                  V4       R#   \         d     L:i ; i)   rO   )
asksavefiler   rK   r9   r   r   r   r   rU   rt   r*   rW   rH   s   && r   r#   IOBinding.save_as   s    ##%~~h''!!(+q!LL224 			""8,	 & s   B B('B(c                    V P                  4       pV'       d   V P                  V4       V P                  P                  4        V P	                  V4       R # )rO   )r   r   r   rU   rt   r   s   && r   r%   IOBinding.save_a_copy   s@    ##%NN8$		""8,r-   c                   V P                  4       pV P                  V4      p \        VR 4      ;_uu_ 4       pVP                  V4       VP	                  4        \
        P                  ! VP                  4       4       RRR4       R#   + '       g   i     R# ; i  \         d8   p\        P                  ! R\        T4      T P                  R7        Rp?R# Rp?ii ; i)wbNTr_   r`   F)fixnewlinesencoder   writeflushrE   fsyncfilenorj   r   rk   rl   r   )r*   rH   r   rv   ru   msgs   &&    r   r   IOBinding.writefile   s    !D!		h%%	$ & 	 &%  	  c#h*.))5	s5   B AB=B B	B B C&,CCc                   \        V P                  R4      '       d7   V P                  P                  RV P                  P	                  R4      4      pMXV P                  P                  R4      R8w  d   V P                  P                  RR4       V P                  P                  RR4      pV P                  R8w  d   VP                  RV P                  4      pV# )zVReturn text with os eols.

       Add prompts if shell else final 
if missing.
       rN   ra   zend-1czend-2c
)	hasattrr   get_prompt_textr   indexgetrc   rq   replacer*   r   s   & r   r   IOBinding.fixnewlines   s     4<<**<<//tyyx7PQDyy}}X&$.		  4099==1D$&<<d&9&9:Dr-   c                V   \        V\        4      '       d   V# V P                  R 8X  d   VP                  R 4      #  VP                  R4      #   \         d     Mi ; i TP                  RR4      p\
        P                  ! \        P                  ! T4      P                  4      w  r4TP                  T4      #   \         d   p\        T4      p Rp?MRp?i\         d    RX,          p Mi ; i\        P                  ! RRT,          T P                  R7       TP                  R 4      # )z	utf-8-sigasciir   NzInvalid encoding '%s'r_   z%s.
Saving as UTF-8r`   )rm   bytesr'   r   UnicodeEncodeErrorrd   detect_encodingioBytesIOreadlinerh   rl   r   rk   r   )r*   rv   encodedrx   _ry   faileds   &&     r   r   IOBinding.encode  s    eU## L+<<,,	<<((! 			3ll7I6G--bjj.A.J.JKFC<<$$ 	XF! 	3,s2F	3"V+99	 ||K((s6   A AAAB8 8C-CC- 
C-,C-c                   \         P                  ! R R\         P                  V P                  R7      pV'       g   V P                  P	                  4        R# RpV P                  4       pV'       d   V P                  pV'       d   Xfa   \        P                  ! RR7      w  rcTp\        P                  ! V4       V P                  V4      '       g   \        P                  ! V4       R# \        P                  pRpVR8X  d#   \        P                  ! R	R
R4      p	V	R,           p	M"VR8X  d   \        P                  ! R	R
R4      p	MRpV'       d   X	\         P"                  ! V4      ,          p	\        P$                  ! V	R4      p
V
P'                  4       P)                  4       pV
P                  4       pV'       d   RV,          V,           pV'       d<   R\+        V	4      ,          V,           p\         P,                  ! RWP                  R7       M+RV,          p\         P.                  ! RWP                  R7       V'       d   \        P                  ! V4       R# )PrintzPrint to Default Printerr}   rO   N	IDLE_tmp_)prefixTposixmainGeneralzprint-command-posixz 2>&1ntzprint-command-winFrz#Printing failed (exit status 0x%x)
zPrinting command: %s
zPrint statusr`   z-Printing is not enabled for this platform: %s)r   askokcancelOKr   rU   r6   rH   tempfilemkstemprE   r2   r   unlinknamer   	GetOptionshlexquotepopenre   stripreprrk   showinfo)r*   rW   r   tempfilenamesavedrH   tfdplatformprintPlatformcommandpipeoutputstatusr   s   &&            r   r(   IOBinding.print_window-  s   ((4$--	$
 II! }}H("*"2"2+"FS#HHHSM>>,//		,'77w((	)>@G'G((	:MNG!MH 55G88GS)DYY[&&(FZZ\F? "()1DMAFJ$$^VIINEPG		JIIl#r-   zPython filesTEXTdarwinz.py c                    V P                  R 4      w  rV P                  '       g2   \        P                  ! V P                  V P
                  R7      V n        V P                  P                  WR7      pV# )r   )r]   	filetypes
initialdirinitialfile)defaultfilename
opendialogr   Openr   r   showr*   dirbaserH   s   &   r   rR   IOBinding.askopenfilej  sW    ((0	(ooTYY:>..JDO??''3'Ir-   c                   V P                   '       d*   \        P                  P                  V P                   4      # V P                  '       d   V P                  R 3#  \        P
                  ! 4       pVR 3#   \         d	    R p TR 3# i ; i)r   )rH   rE   rF   splitrI   getcwdrj   )r*   modepwds   && r   r   IOBinding.defaultfilenamer  st    ===77==//\\\<<##iik 7N  7Ns   A6 6B	B	c                    V P                  R 4      w  rV P                  '       g=   \        P                  ! V P                  V P
                  V P                  R7      V n        V P                  P                  WR7      pV# )r!   )r]   r   defaultextensionr   )r   
savedialogr   SaveAsr   r   r   r   r   s   &   r   r   IOBinding.asksavefile~  sd    ((0	(//99"nn%)%:%:<DO ??''3'Ir-   c                x    V P                   P                  '       d   V P                   P                  V4       R# R# )z-Update recent file list on all editor windowsN)r   rQ   update_recent_files_listrJ   s   &&r   rt   IOBinding.updaterecentfileslist  s)    <<LL11(; r-   )	__id_open
__id_print	__id_save__id_saveas__id_savecopyrI   r   rq   r'   rH   r0   r   r   r   )NN)z
Text filesz*.txtr   )z	All filesr
   )r   )(__name__
__module____qualname____firstlineno__r+   r2   r6   r9   r>   r0   rB   rH   rI   rK   r   rE   ro   rq   rT   rV   r!   r#   r%   r   r   r   r(   r   r   r   r   sysr   r   rR   r   r   rt   __static_attributes____classdictcell____classdict__s   @r   r   r      s     

P
)(%"  ) HG	,*X ZZN9v. )>0d JJ 
/'
I !$ 8ub
< <r-   r   c                 ~   ^ RI HpHp V! V 4      pVP                  R4       \	        \
        V P                  4       P                  R4      R,          4      w  rEVP                  RWE^,           3,          4        ! R R4      pV! V4      pVP                  4        VP                  4        V! V4      p\        V4       R# )	r   )ToplevelTextzTest IOBinding+:r   NNz+%d+%dc                   V   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tRtV tR# )_io_binding.<locals>.MyEditWini  c                   Wn         R V n        V P                   P                  RV P                  4       V P                   P                  RV P                  4       V P                   P                  RV P
                  4       V P                   P                  RV P                  4       V P                   P                  RV P                  4       R # )Nz<Control-o>z<Control-p>z<Control-s>z<Alt-s>z<Control-c>)r   rQ   r   r   printr!   saveassavecopyr   s   &&r   r+   '_io_binding.<locals>.MyEditWin.__init__  s|    IDJIINN=$))4IINN=$**5IINN=$))4IINN9dkk2IINN=$--8r-   c                    ^ # )r   r   r1   s   &r   r6   (_io_binding.<locals>.MyEditWin.get_saved  s    Ar-   c                    R # r5   r   r:   s   &&r   r9   (_io_binding.<locals>.MyEditWin.set_saved  s    4r-   c                    R # r5   r   r1   s   &r   r>   )_io_binding.<locals>.MyEditWin.reset_undo  s    dr-   c                <    V P                   P                  R 4       R# )r   Nr   event_generater   s   &&r   r   #_io_binding.<locals>.MyEditWin.open  s    II$$%@Ar-   c                <    V P                   P                  R 4       R# )r   Nr  r   s   &&r   r  $_io_binding.<locals>.MyEditWin.print  s    II$$%78r-   c                <    V P                   P                  R 4       R# )r   Nr  r   s   &&r   r!   #_io_binding.<locals>.MyEditWin.save  s    II$$%67r-   c                <    V P                   P                  R 4       R# )r   Nr  r   s   &&r   r  %_io_binding.<locals>.MyEditWin.saveas  s    II$$%>?r-   c                <    V P                   P                  R 4       R# )r   Nr  r   s   &&r   r  '_io_binding.<locals>.MyEditWin.savecopy  s    II$$%FGr-   )rQ   r   N)r   r   r   r   r+   r6   r9   r>   r   r  r!   r  r  r   r   r   s   @r   	MyEditWinr    s7     	9 	&'"	B	9	8	@	H 	Hr-   r  N)tkinterr   r   r~   mapintgeometryr   packrU   r   )	r]   r   r   topxyr  r   r   s	   &        r   _io_bindingr$    s    &
6
CIIsFOO%++C045DALLQCL()H H. 9DIIKNNoGgr-   __main__)r   zidlelib.idle_test.test_iomenuF)	verbosityexit)run)r   rE   r   r   r   rd   r  r   r   tkinter.simpledialogr   idlelib.configr   idlelib.utilr   joinr^   r   errorsr   r$  r   unittestr   idlelib.idle_test.htestr(  r   r-   r   <module>r0     s    	 	  
     * # &:M::LLG39Jw< w<t#L z	(AEB+ r-   