3 ^s@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)*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)idleConf)debugger) debugger_r) EditorWindow fixwordbreaks)FileList) OutputWindow)rpc)idle_formatwarningPseudoInputFilePseudoOutputFile) UndoDelegatorz 127.0.0.1cCsP|dkr t}y&|jt|||||d|jdWnttfk rJYnXdS)N)linez>>> )warning_streamwriterAttributeErrorOSError)messagecategoryfilenamelinenorrr '/usr/lib64/python3.6/idlelib/pyshell.pyidle_showwarningCsr"cCs0|rtdkr,tjatt_ntdk r,tt_dadS)N)_warnings_showwarningwarnings showwarningr")Zcapturer r r!capture_warningsVsr&TcCs\tj}i}x:t|D].}|dd|dddkr|j|||<qW|||j|dS)Nrz<>) linecachecachelistpopupdate)rZorig_checkcacher)savekeyr r r!extended_linecache_checkcachees r/c@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)Nz<>z<>z<>zbreakpoints.lstcSs|j|dS)N)restore_file_breaks)Zold_hookselfr r r!filename_changed_hooksz;PyShellEditorWindow.__init__..filename_changed_hook) breakpointsr__init__textbindset_breakpoint_hereclear_breakpoint_hereflist open_shellospathjoinr ZuserdirbreakpointPathioZfilename_change_hookZset_filename_change_hookrr1color_breakpoint_text)r2argsr3r r r!r5s   zPyShellEditorWindow.__init__Cut<>rmenu_check_cutCopy<>rmenu_check_copyPaste <>rmenu_check_pasteNSet Breakpoint<>Clear Breakpoint<>TcCsD|jdkrdS|r(tj}tj|d}n ddd}|jjd|dS)Nbreak) foreground backgroundBREAK)r@r CurrentTheme GetHighlightr6Z tag_config)r2ZcolorthemeZcfgr r r!rAs  z)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|jdd|d|dy|jj|Wn tk rX|jj|YnXy|jj j j }|j ||Wn YnXdS)NrTz%d.0r) r6r@rtag_addr4index ValueErrorappendr:pyshellinterpr r8)r2rr6rdebugr r r!set_breakpoints z"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|jdStt|jd}|j|dS)Ninsert)r6r@rbellintfloatrYr_)r2eventr6rrr r r!r8sz'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s|jdStt|jd}y|jj|Wn YnX|j dddy|j j j j }|j||Wn YnXdS)Nr`rTzinsert linestartzinsert lineend +1char)r6r@rrarbrcrYr4remove tag_remover:r\r]r r9)r2rdr6rrr^r r r!r9s" z)PyShellEditorWindow.clear_breakpoint_herec Csd|jr`|j}|jj}|s$|jdSg|_|jddty|jjj j }|j |Wn YnXdS)NrTz1.0) r4r6r@rrarfZENDr:r\r]r clear_file_breaks)r2r6rr^r r r!rgs 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)titlerr)r4r@ropenr? readlinesr startswithrupdate_breakpointsstrgetattrrootrl tkMessageBox showerrorr6)r2ZbreaksrfplinesZnew_filererrr 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)Nrhrjr)r6r,r@rr<r=isfiler?rnrorpevallenr_)r2rrwrxrZbreakpoint_linenumbersZbreakpoint_linenumberr r r!r1 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|jd}|j|}||_dS)NrT)r6Z tag_rangesranges_to_linenumbersr4)r2r6rangesZlinenumber_listr r r!rqs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|dD]L}tt||j}tt||dj}x||kr`|j||d7}qDWqW|S)Nrr)ranger}rbrcstringr[)r2rrxrYrendr r r!r~"s  z)PyShellEditorWindow.ranges_to_linenumberscCs|jtj|dS)N)rgr_close)r2r r r!r3szPyShellEditorWindow._close)rCrDrE)rFrGrH)rIrJrK)NNN)rLrMN)rNrON)T)N)N)__name__ __module__ __qualname__r5 rmenu_specsrAr_r8r9rgrzr1rqr~rr r r r!r0|s"  *r0c@seZdZeZdZdddZdS)PyShellFileListNcCs8|jr|jjjnt||_|jr2|jjs2dS|jS)N)r\topwakeupPyShellbegin)r2rdr r r!r;Bs  zPyShellFileList.open_shell)N)rrrr0rr\r;r r r r!r9src@s,eZdZddZddZddZddZd S) ModifiedColorDelegatorcCstj||jdS)N)r r5 LoadTagDefs)r2r r r!r5Ps zModifiedColorDelegator.__init__cCs*|jddd|jdddtj|dS)NZTODOz1.0iomarkZSYNC)rfrXr recolorize_main)r2r r r!rTsz&ModifiedColorDelegator.recolorize_maincCsJtj|tj}|jjdddtj|dtj|dtj|dddS)N)rSrRstdoutstderrconsole)stdinrrr)r rr rUtagdefsr,rV)r2rWr r r!rYs   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|ddqWdS)Nrr)rrf)r2tagr r r! removecolorscs z#ModifiedColorDelegator.removecolorsN)rrrr5rrrr r r r!rMs rc@s eZdZdddZdddZdS)ModifiedUndoDelegatorNc CsLy"|jj|ddr |jjdSWntk r6YnXtj||||dS)NZ%dS)CModifiedInterpretercCsH||_tjdj}tj||dd|_d|_d|_t |_ |j j j |_dS)N__main__)localsF) tkconsolesysmodules__dict__rr5save_warnings_filters restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r2rrr r r!r5s zModifiedInterpreter.__init__NcCs&|jdkr|j|_tj|j|_dS)N)rbuild_subprocess_arglist subprocessPopen rpcsubproc)r2r 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)z-c)r warnoptionsr GetOptionr executablerrr)r2riZ 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)Nrr rrrrr:r(r]T)with_cwd)HOSTrrtimeZsleeprrpccltrdisplay_port_binding_errorlistening_sockZ getsocknamerZ setsockoptsocketZ SOL_SOCKETZ SO_REUSEADDRrZ settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrr:r( transfer_pathpoll_subprocess)r2Zaddrir r r!start_subprocesss>       z$ModifiedInterpreter.start_subprocessFrQcCsT|jr |jSd|_|j}|rYnXy|jjWntk rbYnX|jd|j_ d|_dS)NF) _afteridrr6Z after_cancelrrrrrr)r2r r r!kill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|jjWntk r"dSXy|jjWntk rFdSXdS)N)rkillrwait)r2r r r!rsz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtjntj}|jd|fdS)NrQzRif 1: import sys as _sys _sys.path = %r del _sys )extendrr= runcommand)r2rr=r 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?)rZOK)rZ EXCEPTIONz<>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rZ pollresponse active_seqrrKeyboardInterruptrclosingr resetoutputrprintreprgetvarremote_stack_viewerr __stderr__ endexecutingrr6after pollintervalrr)r2ZcltresponseZhowZwhatrerrmsgr r r!r2s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r )r2r r r r! setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r )r2r r r!r]szModifiedInterpreter.getdebuggercCs|jjjd|jdS)Ni,)rr6rr)r2r 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:)ScrolledCanvasTreeNodeZnormalrS)ZbgZhighlightthicknessrZboth)expandZfill)r:)idlelibrr remotequeuerrtraZStubObjectTreeItemZ idlelib.treerrZToplevelr rUrVframeZpackZcanvasr) r2rZoiditemrrrrWrSZscZnoder r r!rms   z'ModifiedInterpreter.remote_stack_viewerrcCs|j|}|j||dS)N) stuffsourceexecfile)r2sourcerr r r! execsources zModifiedInterpreter.execsourcecCs|dkrFtj|.}|j}trd|j}|jd|_|jd}t|dd||ftj|<|S)Nz rrkr)gidsplitr}r(r))r2r rrxr r r!r s    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 )r)r2rr 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)Nrz1.0rmsgrQzrroffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) rr6rfrexc_inforsZcolorize_syntax_errorrrr) r2rrr6rvaluetbrrr posr r r!rs" z#ModifiedInterpreter.showsyntaxerrorcCs6|jj|jtj||jjdr2|jjdS)Nz<>)rrchecklinecacher showtracebackropen_stack_viewer)r2r r r!r&s    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|jD]&}|dd|dddkr||=qWdS)Nrz<>r')r(r)r*keys)r2cr.r r r!r%sz"ModifiedInterpreter.checklinecachecCs@|jjr|jdS|jr0|jjdd|fin t||jdS)Nrrrr)rrdisplay_executing_dialogrrrr)r2rr 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?yes)rrz IDLE internal error in runcode())rFr)rrr]rr%rr$rr beginexecutingrZ asyncqueuerZrunrr SystemExitrruZaskyesnor6r&rrrrcanceledr)r2rr r r r!rsP         zModifiedInterpreter.runcodecCs|jjj|S)N)rrr)r2rr r r!r+szModifiedInterpreter.writecCstjdd|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.)r)rurvrr6)r2r r r!r/sz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjddS)NzSubprocess Startup ErrorzIDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.)r)rurvrr6)r2r r r!r:sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rurvrr6)r2r r r!r*Bsz,ModifiedInterpreter.display_executing_dialog)FrQ)F)N)N)&rrrr5rrrrrrrrrrrrrrr rrrrrr r rr rrr&r%rrrrrr*r 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_Editr^_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_llTps1z>>> rkrchar)wrapz<>z<>z<>z<>z<>z<>z<>z<>z<>)iomenurrrr2)r<r=r')3r menu_specsr`rr]Tkrwithdrawrrr5ZusetabsZ indentwidthhasattrrr?sys_ps1rZprompt_last_linepromptr6Z configurer7enter_callbacklinefeed_callbackcancel_callback eof_callbackr'toggle_debuggertoggle_jit_stack_viewerview_restart_mark restart_shellr save_stdoutr save_stderrr save_stdinrrBrencodingrrpydocZ plainpagerZpagerrr;historyr)r2r:Zmsrtr6rBrVr r r!r5ds`     zPyShell.__init__cCs tjddS)NT)Z shell_only)r Z GetExtensions)r2r r r!get_standard_extension_namessz$PyShell.get_standard_extension_namesFcCs|adS)N)r)r2streamr r r!set_warning_streamszPyShell.set_warning_streamcCstS)N)r)r2r r r!get_warning_streamszPyShell.get_warning_streamcCsH|jr$tjdd|jd|jdS|jj}|r<|jn|jdS)NzDon't debug nowz*You can only toggle the debugger when idle)rrP) rrurvr6set_debugger_indicatorr]rclose_debugger open_debugger)r2rddbr r r!rNs   zPyShell.toggle_debuggercCs|jj}|jd| dS)Nz<>)r]rZsetvar)r2r_r r r!r\s zPyShell.set_debugger_indicatorcCsdS)Nr )r2rdr r r!rOszPyShell.toggle_jit_stack_viewercCsh|jj}|r\|jjd|j|jjr8tj|jj|j|jj d|j |_ |j |j dS)Nz [DEBUG OFF] )r]rrrrr Zclose_remote_debuggerrrrrHrIrr\)r2r_r r r!r]s   zPyShell.close_debuggercCsX|jjrtj|jj|}n tj|}|jj||jd|j|_ |j |j dS)Nz [DEBUG ON] ) r]rr Zstart_remote_debuggerr ZDebuggerrrrHrIrr\)r2Zdbg_guir r r!r^s    zPyShell.open_debuggercCs|jd|_dS)Nr)rr)r2r r r!r,szPyShell.beginexecutingcCsd|_d|_|jdS)Nr)rr.r)r2r 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?ok)rrFZcancelT) rruZ askokcancelr6rr.rrr)r2rr r r!rs z PyShell.closecCsV|jtr|jj|jt_|jt_|j t_ d|_d|_ d|j _ d|_tj|dS)N)r]rr]rrRrrrSrrTrrr:r\rWrr)r2r r r!rs zPyShell._closecCsdS)NTr )r2rr r r!ispythonsource szPyShell.ispythonsourcecCs|jS)N) shell_title)r2r r r! short_title szPyShell.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)Nrr`rQFz==== 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. )r6rrrr]rrr displayhookrrversionplatform COPYRIGHTZ focus_forcertkinterZ _default_root)r2ZnosubZclientrhr r r!rs$  z PyShell.begincCs|js dSd|_|jjdS)NT)reading_stop_readline_flagrquit)r2r 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)NrFrQrzend-1crrk) rirmainlooprjr6getr}rr.rr endoffile)r2r-rr r r!readline1s( zPyShell.readlinecCsdS)NTr )r2r r r!isattyHszPyShell.isattyc Csy|jjdddrdSWn YnX|jp0|jsR|j|jjd|jdSd|_d|_ |jr|jj r|jj r|jj n |jj |jr|jjdS)Nz sel.firstz!=zsel.lastzKeyboardInterrupt rPrr)r6rrrirr]rrrnr.rrrrrrk)r2rdr r r!rLKs&      zPyShell.cancel_callbackcCsh|jr|j rdS|jjdddo0|jjddds6dS|jsN|j|jnd|_d|_|jj dS)Nrz==r`zend-1crrrP) rrir6rrrr.rnrrk)r2rdr r r!rMas  zPyShell.eof_callbackcCs0|jr"|jjdd|jjdn |j|dS)Nr`rkrP)rir6r`seenewline_and_indent_event)r2rdr r r!rKps  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)Nz sel.firstzsel.lastz<=rrPr`rziomark linestartrrrzinsert lineendz>=rzinsert linestartzend-1czend-1c linestartrk)rrir6rmrrecallZ tag_prevrangeZ tag_nextrangerstriprrrr`rqrXZupdate_idletasksrrkrunit)r2rdselprevnextindicesrr r r!rJysX     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*\nrQz\n\s*$rkrvz1.0rr`zend-1czinsert linestart:rrz ^([ \t]*))resubrr6Zundo_block_startrfrrmrstripendswithrrr`rtr}searchgrouprprqZundo_block_stop)r2rrdrxprefixZorig_base_indentZnew_base_indentrr r r!rss*     zPyShell.recallcCs|jjdd}t|}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr||ddkr|d}q^W|d|}|jj|dS)Nrzend-1crrz rk)r6rmr}r]r)r2rrr r r!rus   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]rrrlast_tracebackrurvr6Zidlelib.stackviewerrrtr:)r2rdrr r r!r's    zPyShell.open_stack_viewercCs|jjd|jjddS)Nrr)r6rq)r2rdr r r!rPs zPyShell.view_restart_markcCs|jjdddS)NT)r)r]r)r2rdr r r!rQszPyShell.restart_shellcCs:|j|jj|j|jjdd|j|jjdS)Nr`zend-1c) rrrrIr6rset_line_and_columnr@Z reset_undo)r2r r r!rs zPyShell.showpromptcCsP|jjj}t|ddd}dj|j|}|jds:|d7}|jjj d|ddS)Nr>T)rtabsizeZ expand_tabsrkziomark linestartr) r]rrr r>rAr~ZperZbottomr`)r2rrwrapperZ wrapped_msgr r r! show_warnings   zPyShell.show_warningcCsX|jjdd}|jr |jj||jjddkr>|jjdd|jjdd|jdS)Nrzend-1czend-2crk)r6rmrWZstorer`rr)r2r r 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 Tkrrightrr) isinstancerrr}max enumerateUnicodeEncodeErrorr6rrrr.rr)r2rrrr@countr r r!rs"z PyShell.writec s8y|jjdddrdSWntk r,dSXtjS)Nz sel.firstrrdisabled)r6rrsuperrE)r2) __class__r r!rE&s zPyShell.rmenu_check_cutcs|jjdddrdStjS)Nr`rrr)r6rrrK)r2)rr r!rK.szPyShell.rmenu_check_paste)rr/)r0r1)r^r2)r3r4)r5r6)r7r8)r9r:)N)N)N)N)N)N)N)8rrrrrbrr rrrDrrZidlelib.historyr;r5rXrirr.rnrrjrZr[rNr\rOr]r^r,rrrrarcrgrrrorprLrMrKrJrsrur'rPrQrrrrrErK __classcell__r r )rr!rJsj  <      ?     rcCs6|jdkr2x&dD]}|j|dd|j|dqWdS)NZx11TextEntrySpinboxz <>z%catch {%W delete sel.first sel.last} )rrr)Z_windowingsystemZ bind_class)rtclsr r r! fix_x11_paste4s  ra 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 %s)rrz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t-rQrrzeditor-on-startupr)rZIdle)Z className)rZIconsZWindowszidle.ico)rg333333!@z.pngz.gifcs"g|]}tjjd|fqS)z idle_%d%s)r<r=r>)rsize)exticondirr r!rszmain.. 0cSsg|]}tt|dqS))Zmasterr)Z PhotoImagert)riconfiler r r!rsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )rrr)T)Hgetoptrfrrrrr&rrargvrr usage_msgrexitrrr<r=r{rrbrrrr}rr[dirnamer`getcwdr rZ NoDefaultRootrErtrF idlelib.runrr>__file__Z wm_iconbitmap TkVersionZ wm_iconphotorrrr:ZsetupApprnrenewr;ZisAquaTkdictrlowerr\r^environrmr]r rr rZtkVersionWarningrZpreferTabsPreferenceWarningZ inversedictrlZdestroy)rrrrZ enable_shellZ enable_editr^cmdZscriptZstartupZoptsrBroarZpathxrdirZ edit_startrrZ iconfilesZiconsr<ZtkversionwarningZprefer_tabs_preference_warningr )rrr!rus                                   rrr\F)NN)Orrh ImportErrorrrr-rfZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrurrErtrFrrrvrrr(r<Zos.pathrr{rrtextwrapr rrr r$Zidlelib.colorizerr Zidlelib.configr rr r Zidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrrrr"r#r& checkcacher/r0rrrZ RPCClientrrrrrrrrr r r r!s                  >Hm?1