JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrB  fP @sddlZddlmZddlZddlZddlZddlZddlZddlmZ ddl m Z ddl mZddlZddlmZejrdZdZnyddlZeejdWneejfk rYnXejdkrdZdZnyeejZereeWnXee e!fk rDy e"d Zer"eeWne#e!fk r>YnXYnXerZe$Zd Znd ZdZe%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_regroupcodecslookup LookupError)datalinesZlstlinernamer3/opt/alt/python37/lib64/python3.7/idlelib/iomenu.py coding_specBs*      rc@seZdZddZddZddZddZd d Zd Zd d Z d Z d Z ddZ d4ddZ dZeeZejZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd Zd Z d'Z!e"j#d(krd)nd*Z$d+d,Z%d5d.d/Z&d0d1Z'd2d3Z(d S)6 IOBindingcCsr||_|j|_|jd|j|_|jd|j|_|jd|j|_|jd|j |_ d|_ |jd|j |_ dS)Nz<>z<>z<>z<>z<>)editwintextbindopen_IOBinding__id_opensave_IOBinding__id_savesave_as_IOBinding__id_saveas save_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<>z<>z<>z<>z<>) 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 flist askopenfilegetattrr;r2r#loadfiler! focus_set maybesave)r.eventZeditFilerAr;replyrrrr#s6       zIOBinding.openz (\r\n)|\n|\rc CsBy|j j t d d t|j j 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)rQZ askokcancelZOKr!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) initialdir initialfile)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 Zd d Zd dZ ddZ ddZ dS)z_io_binding..MyEditWincSs`||_d|_|jd|j|jd|j|jd|j|jd|j|jd|jdS)Nz z z zz )r!rAr"r#printr%saveassavecopy)r.r!rrrr/sz'_io_binding..MyEditWin.__init__cSsdS)Nrr)r.rrrr2$z(_io_binding..MyEditWin.get_savedcSsdS)Nr)r.r4rrrr3%rz(_io_binding..MyEditWin.set_savedcSsdS)Nr)r.rrrr5&rz)_io_binding..MyEditWin.reset_undocSs|jddS)Nz<>)r!event_generate)r.rGrrrr#'sz#_io_binding..MyEditWin.opencSs|jddS)Nz<>)r!r)r.rGrrrr)sz$_io_binding..MyEditWin.printcSs|jddS)Nz<>)r!r)r.rGrrrr%+sz#_io_binding..MyEditWin.savecSs|jddS)Nz<>)r!r)r.rGrrrr-sz%_io_binding..MyEditWin.saveascSs|jddS)Nz<>)r!r)r.rGrrrr/sz'_io_binding..MyEditWin.savecopyN) rrrr/r2r3r5r#rr%rrrrrr MyEditWinsr) ZtkinterrrramapintZgeometryrZpackrEr) rJrrrootxyrr!r rrr _io_bindings  r__main__)r{zidlelib.idle_test.test_iomenur F) verbosityexit)run)1rrr8rrrr~Ztkinter.filedialogZ filedialogrZtkinter.messageboxZ messageboxrQZtkinter.simpledialogrZidlelibZidlelib.configrZtestingrferrorsZlocale setlocaleLC_CTYPE ImportErrorErrorr nl_langinfoCODESETZlocale_encodingr NameErrorrlrZgetdefaultlocale ValueErrorlowerrASCIIrrrrrrZunittestr{Zidlelib.idle_test.htestrrrrrsf         ),$