3 ^sc@sddlZy ddlTWn*ek r>edejdedYnXejdkry ddlZdZej dj eWnee e fk rYnXddl jZedkreatjdd lmZetejd d etd eddd lmZddlZddlZddlZddlmZddlZddlZddlZddl m!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl*m,Z,ddl-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl*m4Z4ddlm5Z5m6Z6m7Z7ddl8m9Z9dZ:dZ;ejaddZ?e?ddej@fd d!ZAeAe_@Gd"d#d#e.ZBGd$d%d%e1ZCGd&d'd'e'ZDGd(d)d)e9ZEGd*d+d+e4jFZGGd,d-d-eZHGd.d/d/e3ZId0d1ZJd2ZKd3d4ZLeMd5krejNd5ejNd6<eLe?d7dS)9N)Z*zJ** IDLE can't import Tkinter. Your Python may not be configured for Tk. **fileZwin32Zshcoreg!@ fix_scalingzIdle Cannot Startz"Idle requires tcl/tk 8.5+, not %s.parent)InteractiveInterpreter)python_version) TextWrapper)ColorDelegator)idleConfdebugger) debugger_r) EditorWindow fixwordbreaks)FileList) OutputWindow)rpc)idle_formatwarningPseudoInputFilePseudoOutputFile) UndoDelegatorz 127.0.0.1cCsP|dkr t}y&|jt|||||d|jdWnttfk rJYnXdS)N)line>>> )warning_streamwriterAttributeErrorOSError)messagecategoryfilenamelinenorrr#'/usr/lib64/python3.6/idlelib/pyshell.pyidle_showwarningCsr%cCs0|rtdkr,tjatt_ntdk r,tt_dadSN)_warnings_showwarningwarningsZ showwarningr%)Zcapturer#r#r$capture_warningsVsr)TcCs\tj}i}x:t|D].}|dd|dddkr|j|||<qW|||j|dSNrz<>) linecachecachelistZpopupdate)r!Zorig_checkcacher-savekeyr#r#r$extended_linecache_checkcachees r2c@szeZdZddZd&d'd(d)d*d+gZd,ddZddZd-ddZd.ddZddZ ddZ ddZ d d!Z d"d#Z d$d%Zd S)/PyShellEditorWindowcGsg|_tj|f||jjd|j|jjd|j|jjd|jjt j j t j d|_|jj|fdd}|jj||jjr|j|jdS)N<><>z<>zbreakpoints.lstcSs|j|dSr&)restore_file_breaks)Zold_hookselfr#r#r$filename_changed_hookz;PyShellEditorWindow.__init__..filename_changed_hook) breakpointsr__init__textbindset_breakpoint_hereclear_breakpoint_hereflist open_shellospathjoinr ZuserdirbreakpointPathioZfilename_change_hookZset_filename_change_hookr!r6color_breakpoint_text)r7argsr8r#r#r$r;s   zPyShellEditorWindow.__init__Cut<>rmenu_check_cutCopy<>rmenu_check_copyPaste <>rmenu_check_pasteNSet Breakpointr4Clear Breakpointr5TcCsD|jdkrdS|r(tj}tj|d}n ddd}|jjd|dS)Nbreak) foreground backgroundBREAK)rFr CurrentTheme GetHighlightr<Z tag_config)r7ZcolorthemeZcfgr#r#r$rGs  z)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|jdd|d|dy|jj|Wn tk rX|jj|YnXy|jj j j }|j ||Wn YnXdS)NrXz%d.0r) r<rFr!tag_addr:indexZ ValueErrorappendr@pyshellinterprr>)r7r"r<r!debugr#r#r$set_breakpoints z"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|jdStt|jd}|j|dS)Ninsert)r<rFr!bellintfloatr]rb)r7eventr<r!r"r#r#r$r>sz'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s|jdStt|jd}y|jj|Wn YnX|j dddy|j j j j }|j||Wn YnXdS)NrcrXinsert linestartzinsert lineend +1char)r<rFr!rdrerfr]r:remove tag_remover@r_r`rr?)r7rgr<r!r"rar#r#r$r?s" z)PyShellEditorWindow.clear_breakpoint_herec Csd|jr`|j}|jj}|s$|jdSg|_|jddty|jjj j }|j |Wn YnXdS)NrX1.0) r:r<rFr!rdrjZENDr@r_r`rclear_file_breaks)r7r<r!rar#r#r$rls z%PyShellEditorWindow.clear_file_breakscCs|j}|jj}y$t|jd}|j}WdQRXWntk rJg}YnXynt|jdX}x$|D]}|j|dsb|j|qbW|j |j}|r|j|dt |dWdQRXWnVtk r}z8t |j ddsd|j _ tjdd t ||jd WYdd}~XnXdS) Nrw= breakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Ztitlerr)r:rFr!openrE readlinesr startswithrupdate_breakpointsstrgetattrrootrq tkMessageBox showerrorr<)r7Zbreaksr!fplinesZnew_filerZerrr#r#r$store_file_breakss.  (z%PyShellEditorWindow.store_file_breaksc Cs|jj|jdkrdS|jj}|dkr,dStjj|jrt|jd}|j }WdQRXxJ|D]B}|j |dr`t |t |dd}x|D]}|j |qWq`WdS)Nrmror)r<r/rFr!rBrCisfilerErrrsrtZevallenrb)r7r!r{r|rZbreakpoint_linenumbersZbreakpoint_linenumberr#r#r$r6 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|jd}|j|}||_dS)NrX)r<Z tag_rangesranges_to_linenumbersr:)r7r<rangesZlinenumber_listr#r#r$rus  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|dD]L}tt||j}tt||dj}x||kr`|j||d7}qDWqW|S)Nrr)rangerrerfZstringr^)r7rr|r]r"endr#r#r$r"s  z)PyShellEditorWindow.ranges_to_linenumberscCs|jtj|dSr&)rlr_closer7r#r#r$r3r9zPyShellEditorWindow._close)rIrJrK)rLrMrN)rOrPrQ)NNN)rRr4N)rSr5NTr&r&)__name__ __module__ __qualname__r; rmenu_specsrGrbr>r?rlr}r6rurrr#r#r#r$r3|s"  *r3c@seZdZeZdZdddZdS)PyShellFileListNcCs8|jr|jjjnt||_|jr2|jjs2dS|jSr&)r_topZwakeupPyShellbeginr7rgr#r#r$rABs  zPyShellFileList.open_shellr&)rrrr3rr_rAr#r#r#r$r9src@s,eZdZddZddZddZddZd S) ModifiedColorDelegatorcCstj||jdSr&)r r; LoadTagDefsrr#r#r$r;P zModifiedColorDelegator.__init__cCs*|jddd|jdddtj|dS)NZTODOrkiomarkZSYNC)rjr\r recolorize_mainrr#r#r$rTsz&ModifiedColorDelegator.recolorize_maincCsJtj|tj}|jjdddtj|dtj|dtj|dddS)N)rWrVstdoutstderrconsole)stdinrrr)r rr rYtagdefsr/rZ)r7r[r#r#r$rYs   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|ddqWdS)Nrr)rrj)r7tagr#r#r$ removecolorscs z#ModifiedColorDelegator.removecolorsN)rrrr;rrrr#r#r#r$rMs rc@s eZdZdddZdddZdS)ModifiedUndoDelegatorNc CsLy"|jj|ddr |jjdSWntk r6YnXtj||||dSNZ%dS)CModifiedInterpretercCsH||_tjdj}tj||dd|_d|_d|_t |_ |j j j |_dS)N__main__)localsF) tkconsolesysmodulesZ__dict__rr;save_warnings_filters restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r7rrr#r#r$r;s zModifiedInterpreter.__init__NcCs&|jdkr|j|_tj|j|_dSr&)rbuild_subprocess_arglist subprocessZPopen rpcsubprocrr#r#r$spawn_subprocesss  z$ModifiedInterpreter.spawn_subprocesscCs^ddtjD}tjdddddd}td kr8d |f}n d |f}tjg|d |t|jgS) NcSsg|] }d|qS)z-Wr#).0sr#r#r$ sz@ModifiedInterpreter.build_subprocess_arglist..mainGeneralzdelete-exitfuncFbool)defaulttypezidlelib.pyshellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)-c)rZ warnoptionsr GetOptionrZ executablervr)r7rnZ del_exitfZcommandr#r#r$rs    z,ModifiedInterpreter.build_subprocess_arglistc CsZt|jf}xLtdD]4}tj|yt||_PWqtk rFYqXqW|jdS|jj j d|_t dkr|jj j t jt jd|j|jj jdy|jjWnt jk r|jdSX|jjd|j|jjd|jj|jjd|jj|jjd|jj|jjd |jj|jjd t|jjd ||jd d |j|jS)Nirri rrrrr@r,r`Twith_cwd)HOSTrrtimeZsleeprrpccltrdisplay_port_binding_errorlistening_sockZ getsocknamerZ setsockoptsocketZ SOL_SOCKETZ SO_REUSEADDRrZ settimeoutaccepttimeoutdisplay_no_subprocess_errorZregisterrrrrr@r, transfer_pathpoll_subprocess)r7Zaddrir#r#r$start_subprocesss>       z$ModifiedInterpreter.start_subprocessFrUcCsT|jr |jSd|_|j}|rYnXy|jjWntk rbYnX|jd|j_ d|_dS)NF) _afteridrr<Z after_cancelrrrrrrrr#r#r$kill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|jjWntk r"dSXy|jjWntk rFdSXdSr&)rZkillrwaitrr#r#r$rsz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtjntj}|jd|fdS)NrUzRif 1: import sys as _sys _sys.path = %r del _sys )ZextendrrC runcommand)r7rrCr#r#r$r#s z!ModifiedInterpreter.transfer_pathcCs6|j}|dkrdSy|j|jdd}Wn2tttfk rX|jjrHdSd}|jYnX|r|jj d|_|\}}|jj }|dkr|dk rt t ||dnH|dkr|jj dr|jn*|dkrd}t ||tjdt |||dy|jjWntk rYnX|jjs2|jjj|jj|j|_dS) Ng?)rZOKrZ EXCEPTION<>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rZ pollresponse active_seqrrKeyboardInterruptrclosingr resetoutputrprintZreprgetvarremote_stack_viewerr __stderr__ endexecutingrr<after pollintervalrr)r7ZcltresponseZhowZwhatrZerrmsgr#r#r$r2s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dSr&r )r7rr#r#r$ setdebuggerZrzModifiedInterpreter.setdebuggercC|jSr&r rr#r#r$r]rzModifiedInterpreter.getdebuggercCs|jjjd|jdS)Ni,)rr<rrrr#r#r$open_remote_stack_viewer`s z,ModifiedInterpreter.open_remote_stack_viewerc Csddlm}|jjddd i}|dkr6|jjjdS|j|j|}ddlm }m }t |jj}t j }t j|dd}|||dd } | jjd d d || jd|} | jdS)Nr) debugobj_rrZ stackviewerr@)ScrolledCanvasTreeNodeZnormalrW)ZbgZhighlightthicknessrZboth)expandZfill)r@)idlelibrr remotequeuerrxrdZStubObjectTreeItemZ idlelib.treerrZToplevelr rYrZZframeZpackZcanvasr) r7rZoidZitemrrrr[rWZscZnoder#r#r$rms   z'ModifiedInterpreter.remote_stack_viewerrcCs|j|}|j||dSr&) stuffsourceexecfiler7sourcer!r#r#r$ execsources zModifiedInterpreter.execsourcecCs|dkrFtj|.}|j}trd|j}|jd|_|jd}t|dd||ftj|<|S)Nz rrpr)gidsplitrr,r-)r7rr!r|r#r#r$rs    zModifiedInterpreter.stuffsourcecCs|jd|fdS)Na(if 1: _filename = %r import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir )rr7r!r#r#r$prepend_syspathsz#ModifiedInterpreter.prepend_syspathc Cs|j}|j}|jdddtj\}}}t|ddp:|p:d}t|ddpJd}t|d dpZd } | d krl|d7}|dkrd | d} nd |d| df} |j|| |j|jd ||j dS)NrrkrmsgrUzr"roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) rr<rjrZexc_inforwZcolorize_syntax_errorrrr) r7r!rr<rZvalueZtbrr"rZposr#r#r$rs" z#ModifiedInterpreter.showsyntaxerrorcCs6|jj|jtj||jjdr2|jjdS)Nr)rrchecklinecacher showtracebackropen_stack_viewerrr#r#r$rs    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|jD]&}|dd|dddkr||=qWdSr*)r,r-r.Zkeys)r7Zcr1r#r#r$rsz"ModifiedInterpreter.checklinecachecCs@|jjr|jdS|jr0|jjdd|fin t||jdS)Nrrrr)rrdisplay_executing_dialogrrrr)r7rr#r#r$rs zModifiedInterpreter.runcommandcCst|jjr|jj|j|jdk r:|jtjdd<d|_|j}zyV|jj | rx|j dk rx|j j dd|fi|_ n |r|j ||jn t||jWntk r|jjstjddd|jjdr̂q|jnYnbtr td|jjd|j|jjn,|jjr0d |j_td |jjdn|jYnXWdtsny|jjWntk rlYnXXdS) NrrzExit?zDo you want to exit altogether?Zyesrrz IDLE internal error in runcode()rFr)rrr`rrrr(rrbeginexecutingrZ asyncqueuerZrunrr SystemExitrryZaskyesnor<rr rrrcanceledr)r7rrr#r#r$rsP         zModifiedInterpreter.runcodecCs|jjj|Sr&)rrr)r7rr#r#r$r+rzModifiedInterpreter.writecCtjdd|jjddS)NzPort Binding ErroraAIDLE can't bind to a TCP/IP port, which is necessary to communicate with its Python execution server. This might be because no networking is installed on this computer. Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.rryrzrr<rr#r#r$r/sz.ModifiedInterpreter.display_port_binding_errorcCr")NzSubprocess Startup ErrorzIDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.rr#rr#r#r$r:sz/ModifiedInterpreter.display_no_subprocess_errorcCr")NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rr#rr#r#r$rBsz,ModifiedInterpreter.display_executing_dialog)FrU)Fr&r&)&rrrr;rrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrr#r#r#r$rsF + - &    1 rcseZdZdedZeZeZdZd[d\d]d^d_gZ e j d`gZ ddl m Z daddZddZdZdZdZdZdZdZddZddZdbddZdd Zdcd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Z d/d0Z!d1d2Z"d3Z#d4d5Z$d6d7Z%d8d9Z&d:d;Z'dddd?Z)d@dAZ*dBdCZ+dDdEZ,dFdGZ-dedHdIZ.dfdJdKZ/dgdLdMZ0dNdOZ1dPdQZ2dRdSZ3ffdTdUZ4fdVdWZ5fdXdYZ6Z7S)hrzPython z Shellr_Fileedit_Editra_Debugoptions_Optionswindow_Windowhelp_HelpSqueeze<>r)HistoryNc Cstr&|j}|dddkr&|jddt||_|dkrVt}t||jt|}t j ||ddd|_ d|_ t tdrtjnd|_|jjd d|_|j|_|j}|jd d |jd |j|jd|j|jd|j|jd|j|jd|j|jd|j|jd|jtr8|jd|j|jd|jtj |_!tj"|_#tj$|_%ddl&m'}t(|d|j)|_$t*|d|j)|_ t*|d|j)|_"t*|d|j)|_+ts|j t_ |j"t_"|j$t_$yddl,}|j-|_.Wntj/t_"YnX|j0|j|_1d|_2dS)NrrshellShe_llTps1rrprchar)wrapz<>z<>z<>z<>z<><>rz<>z<>)iomenurrrri2)r1r2r+)3r  menu_specsrcrr`Tkrwithdrawrrr;ZusetabsZ indentwidthZhasattrrr4sys_ps1rZprompt_last_linepromptr<Z configurer=enter_callbacklinefeed_callbackcancel_callback eof_callbackrtoggle_debuggertoggle_jit_stack_viewerview_restart_mark restart_shellr save_stdoutr save_stderrr save_stdinrr8rZencodingrrpydocZ plainpagerZpagerrr0historyr)r7r@Zmsrxr<r8rIr#r#r$r;ds`     zPyShell.__init__cCs tjddS)NT)Z shell_only)r Z GetExtensionsrr#r#r$get_standard_extension_namesrz$PyShell.get_standard_extension_namesFcCs|adSr&r)r7Zstreamr#r#r$set_warning_streamrzPyShell.set_warning_streamcCstSr&rLrr#r#r$get_warning_streamrzPyShell.get_warning_streamcCsH|jr$tjdd|jd|jdS|jj}|r<|jn|jdS)NzDon't debug nowz*You can only toggle the debugger when idlerrT) rryrzr<set_debugger_indicatorr`rclose_debugger open_debugger)r7rgdbr#r#r$rBs   zPyShell.toggle_debuggercCs|jj}|jd| dS)Nr7)r`rZsetvarr7rRr#r#r$rOrzPyShell.set_debugger_indicatorcCsdSr&r#rr#r#r$rCrzPyShell.toggle_jit_stack_viewercCsh|jj}|r\|jjd|j|jjr8tj|jj|j|jj d|j |_ |j |j dS)Nz [DEBUG OFF] )r`rrrrrZclose_remote_debuggerrrrr<r=rrOrSr#r#r$rPs   zPyShell.close_debuggercCsX|jjrtj|jj|}n tj|}|jj||jd|j|_ |j |j dS)Nz [DEBUG ON] ) r`rrZstart_remote_debuggerrZDebuggerrrr<r=rrO)r7Zdbg_guir#r#r$rQs    zPyShell.open_debuggercCs|jd|_dS)Nr)rrrr#r#r$rr9zPyShell.beginexecutingcCsd|_d|_|jdS)Nr)rr!rrr#r#r$rszPyShell.endexecutingcCsD|jr&tjddd|jd}|dkr&dS|jd|_d|_tj|S)NzKill?z7Your program is still running! Do you want to kill it?ZokrFZcancelT) rryZ askokcancelr<rr!rrr)r7rr#r#r$rs z PyShell.closecCsV|jtr|jj|jt_|jt_|j t_ d|_d|_ d|j _ d|_tj|dSr&)rPr r`rrFrrrGrrHrrr@r_rJrrrr#r#r$rs zPyShell._closecCdSNTr#rr#r#r$ispythonsource rzPyShell.ispythonsourcecCrr&) shell_titlerr#r#r$ short_title rzPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs|jjdd|jtr:d}|jj}|sF|jdSn d}tjt _|j d t j t j |j |f|jj|jd dl}d|_d S)NrrcrUFz==== No Subprocess ==== z9WARNING: Running IDLE without a Subprocess is deprecated z;and will be removed in a later version. See Help/IDLE Help zfor details. zPython %s on %s %s %srTzR==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated z==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help z==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help for details. )r<rrr r`rrrZ displayhookrrZversionplatform COPYRIGHTZ focus_forcertkinterZ _default_root)r7ZnosubZclientr[r#r#r$rs$  z PyShell.begincCs|js dSd|_|jjdSrU)reading_stop_readline_flagrquitrr#r#r$r+szPyShell.stop_readlinec Cs|j}zd|_|jjWd||_X|jr4d|_dS|jjdd}t|dkrRd}|j|jrnd|_t snt |j r~d|_ d}|S)NrFrUrrrrp) r\rmainloopr]r<getrrr!r r endoffile)r7r0rr#r#r$readline1s( zPyShell.readlinecCrTrUr#rr#r#r$isattyHrzPyShell.isattyc Csy|jjdddrdSWn YnX|jp0|jsR|j|jjd|jdSd|_d|_ |jr|jj r|jj r|jj n |jj |jr|jjdS)N sel.firstz!=sel.lastzKeyboardInterrupt rTrr)r<rrr\rr`rrrar!rrrrrr^rr#r#r$r@Ks&      zPyShell.cancel_callbackcCsh|jr|j rdS|jjdddo0|jjddds6dS|jsN|j|jnd|_d|_|jj dS)Nrz==rcrrrrT) rr\r<rrrr!rarr^rr#r#r$rAas  zPyShell.eof_callbackcCs0|jr"|jjdd|jjdn |j|dS)NrcrprT)r\r<rcseenewline_and_indent_eventrr#r#r$r?ps  zPyShell.linefeed_callbackc Cs<|jr|j rdSy6|jjdd}|rF|jjdddrF|j||dSWn YnX|jjdddrX|jjd d}|r|jjdd|d r|j|jj|d |d |dS|jjd d}|r|jjd d |d r|j|jj|d |d |dS|jjdd}|r>|jj|d ddr>|j|jj|d d |n|j|jjdd |dS|jjdddrx|jjdd|jjdd}|r|j r|jj dd|jjdddr|j |dS|jjdd|jr|jj dd|jj dn |j ||jjd dd|jj|jr0|jjn|jdS)Nrdrez<=rrTrcriomark linestartrrrzinsert lineendz>=rrhrzend-1c linestartrp)rr\r<r`rrecallZ tag_prevrangeZ tag_nextrangerstriprrgrcrfr\Zupdate_idletasksrr^runit)r7rgselZprevZnextZindicesrr#r#r$r>ysX     zPyShell.enter_callbackc Cs<tjdd|}tjdd|}|jd}|jjz|jjddd|jjdd |jjd d}|jj d r|j ||jjd d}|jj d|d j t |d krtjd|d jd }tjd|jd }xJ|d dD]:}|j|r||t |d}|jj dd|jqWWd|jjd|jjXdS)Nz^\s*\nrUz\n\s*$rprlrkrrcrrhz:rrz ^([ \t]*))reZsubrr<Zundo_block_startrjrr`ZrstripendswithrgrcrjrZsearchZgrouprtrfZundo_block_stop)r7rrgr|ZprefixZorig_base_indentZnew_base_indentrr#r#r$ris*     zPyShell.recallcCs|jjdd}t|}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr||ddkr|d}q^W|d|}|jj|dS)Nrrrrz rp)r<r`rr`r)r7rrr#r#r$rks   z PyShell.runitc CsX|jjr|jjSy tjWntjdd|jddSddlm }||j |j dS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined)rr) StackBrowser) r`rrrZlast_tracebackryrzr<Zidlelib.stackviewerrorxr@)r7rgror#r#r$rs    zPyShell.open_stack_viewercCs|jjd|jjddS)Nrr)r<rfrr#r#r$rDs zPyShell.view_restart_markcCs|jjdddS)NTr)r`rrr#r#r$rErzPyShell.restart_shellcCs:|j|jj|j|jjdd|j|jjdS)Nrcr) rrrr=r<rset_line_and_columnrFZ reset_undorr#r#r$rs zPyShell.showpromptcCsP|jjj}t|ddd}dj|j|}|jds:|d7}|jjj d|ddS)Nr3T)rZtabsizeZ expand_tabsrprhr) r`rrr rDr6rnZperZbottomrc)r7rrZwrapperZ wrapped_msgr#r#r$ show_warnings   zPyShell.show_warningcCsX|jjdd}|jr |jj||jjddkr>|jjdd|jjdd|jdS)Nrrzend-2crp)r<r`rJZstorercrrp)r7rr#r#r$rs zPyShell.resetoutputc Cst|trRt|rRt|dkrRxt|D]\}}|dkr(Pq(Wtd|||ddy0|jjddtj |||d}|jjddWnYnX|j rd|_ t st |S) Nu￿zUCS-2rz%Non-BMP character not supported in TkrZrightrr) Z isinstancervrZmaxZ enumerateZUnicodeEncodeErrorr<rrrr!r r)r7rrrr5Zcountr#r#r$rs"z PyShell.writec s8y|jjdddrdSWntk r,dSXtjS)Nrdrrdisabled)r<rrsuperrKrZ __class__r#r$rK&s zPyShell.rmenu_check_cutcs|jjdddrdStjS)Nrcrrrr)r<rrsrQrrtr#r$rQ.szPyShell.rmenu_check_paste)rr$)r%r&)rar')r(r))r*r+)r,r-)r.r/r&r&r&r&r&r&r&)8rrrr rWrr rrr9rrZidlelib.historyr0r;rKr\rr!rarr]rMrNrBrOrCrPrQrrrrrVrXrZrrrbrcr@rAr?r>rirkrrDrErrqrrrKrQZ __classcell__r#r#rtr$rJsj  <      ?     rcCs6|jdkr2x&dD]}|j|dd|j|dqWdS)NZx11TextEntrySpinboxz <>z%catch {%W delete sel.first sel.last} )rurvrw)Z_windowingsystemZ bind_class)rxZclsr#r#r$ fix_x11_paste4s  rxa USAGE: idle [-deins] [-t title] [file]* idle [-dns] [-t title] (-c cmd | -r file) [arg]* idle [-dns] [-t title] - [arg]* -h print this help message and exit -n run IDLE without a subprocess (DEPRECATED, see Help/IDLE Help for details) The following options will override the IDLE 'settings' configuration: -e open an edit window -i open a shell window The following options imply -i and will open a shell: -c cmd run the command in a shell, or -r file run script from file -d enable the debugger -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window A default edit window will be bypassed when -c, -r, or - are used. [arg]* are passed to the command (-c) or script (-r) in sys.argv[1:]. Examples: idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print(sys.argv)" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print(sys.argv)" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. cs\ddl}ddlm}ddlm}ddlm}tddad}d}d}d}d}d} y|jtj ddd\} } WnD|j k r} z&t d | t ftj d tjd WYdd} ~ XnXx| D]\} }| d kr|}d}| d krd}d}| dkrd}| dkr tjjt tj| dkrd}| dkr6t dtj d da| dkrj|}tjj|rTnt d|tjd}| dkr|d} d}| dkr|t_d}qW| r| ddkrtjj}d}x0tttjD]}tjjtj|tj|<qW| r| ddkrdg| ddt_ n|r$d g| t_ n|r8|g| t_ n| rd}g}x | D]}|jtjj|qLWxX|D],}tjj|}|tjkrntjjd|qnWn"tj}|tjkrtjjd|tj ddddd}|p|}|p| }tr| rt!t"dda#t#j$dd l%m&}|t#tjj'tjjt(d!|d"krbtjj'd#}t#j)|d$nBt*d%krpd&nd'fd(d)d1D}d-d)|D}t#j+d2|t,t#t-t#t.t#a/|j0t#t/|r|p|sx0| ddD] }t/j1|dkr| j2|qW| st/j3|rPt/j4}|s2dS|j5rVt/j6rV|j7j8nt/j9}|rd|j:| rtj;j||s|r|j=j?d0tj f|r|j=j@|n|r0|j=jA||j=j>|n8|r0|jBt#}|r|jC||jD}|r0|jC|xt/jErFt#jFq2Wt#jGtddS)3Nr)system)testing)macosxTFrz c:deihnr:st:z Error: %s %srrrz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tz-rUrrzeditor-on-startupr)rZIdle)Z classNamerZIconsZWindowszidle.ico)rg333333!@z.pngz.gifcs"g|]}tjjd|fqS)z idle_%d%s)rBrCrD)rZsizeZextZicondirr#r$rzmain.. 0cSsg|]}tt|dqS))Zmasterr)Z PhotoImagerx)riconfiler#r#r$rr}Z IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )r~rrr)HgetoptrYryrrzr{r)r rZargvrr usage_msgrZexitrrrBrCr~rrWrr rrr r^ZdirnamercZgetcwdr rZ NoDefaultRootr:rxr; idlelib.runrrDZ__file__Z wm_iconbitmap TkVersionZ wm_iconphotorrxrr@ZsetupApprrriZnewrAZisAquaTkZdictrZlowerr_rQZenvironr`r`rrr rZtkVersionWarningrqZpreferTabsPreferenceWarningZ inversedictr_Zdestroy)rryrzr{Z enable_shellZ enable_editraZcmdZscriptZstartupZoptsrHrZoZarZpathxr!ZdirZ edit_startrrZ iconfilesZiconsr1ZtkversionwarningZprefer_tabs_preference_warningr#r|r$rus                                   rrr_F)NN)Orr[Z ImportErrorrrr rYZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxryrr:rxr;rrrzrrr,rBZos.pathr rmrrZtextwrapr rrr r(Zidlelib.colorizerr Zidlelib.configr rrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrrrr%r'r)Z checkcacher2r3rrrZ RPCClientrrrrxrrrrr#r#r#r$Zs                  >Hm?1