\dQ dZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl m Z ddl mZd ZGd d Zed krdd lmZedddSdS)aExecute code from an editor. Check module: do a full syntax check of the current module. Also run the tabnanny to catch any inconsistent tabs. Run module: also execute the module's code in the __main__ namespace. The window must have been saved previously. The module is added to sys.modules, and is also added to the __main__ namespace. TODO: Specify command line arguments in a dialog box. N) messagebox)idleConf)macosx)pyshell) CustomRun)outwina/Error: Inconsistent indentation detected! 1) Your indentation is outright incorrect (easy to fix), OR 2) Your indentation mixes tabs and spaces. To fix case 2, change all tabs to spaces by using Edit->Select All followed by Format->Untabify Region and specify the number of columns used by each tab. cJeZdZdZdZdZdZdZdddZd Z d Z d Z d S) ScriptBindingct||_|jj|_|jj|_g|_d|_dS)Ng)editwinflistrootcli_argsperf)selfr s "..\python\lib\idlelib\runscript.py__init__zScriptBinding.__init__&s5 \' L%   ct|jtjr |jjdS|}|sdS||sdS||sdSdS)Nbreak) isinstancer r OutputWindowtextbell getfilename checksyntaxtabnanny)reventfilenames rcheck_module_eventz ScriptBinding.check_module_event0s dlF$7 8 8  L  " " $ $ $7##%% 7)) 7}}X&& 7wrc^tj|5} tjtj|jn#tj$rV}|j\}\}}|j || dd|zYd}~ddddSd}~wtj $r]}|j | | dtYd}~ddddSd}~wwxYw dddn #1swxYwYdS)NzTabnanny Tokenizing ErrorzToken Error: %sFzTab/space errorT)tokenizeopenrprocess_tokensgenerate_tokensreadline TokenErrorargsr gotolineerrorboxNannyNag get_linenoindent_message)rrfmsgmsgtxtlinenostartnags rrzScriptBinding.tabnanny=s ]8 $ $  '(@(L(LMMMM&   *-(' %%f--- 9/&8:::uuu        $    %%cnn&6&6777 /@@@uuu         N               tsND"+AD"DAB#D"#D5AD <D" DD""D&)D&c|jx|_}|}||jt |d5}|}dddn #1swxYwYd|vr,|dd}|dd}|r|dtdkr|dz}|j }|j }| ddd t||d ||S#ttt f$r}t#|d d p|pd } t#|d d pd} t#|dd pd} | dkr| dz } d| dz | dz fz} ||| |dd| zYd}~||dSd}~wwxYw#||wxYw)Nrb s  ERRORz1.0endexecr/zr1offsetrz0.0 + %d lines + %d chars SyntaxErrorz%-20sF)r open_shellshellget_warning_streamset_warning_streamstderrr#readreplaceordr r tag_removecompiler? OverflowError ValueErrorgetattrcolorize_syntax_errorr*) rrrA saved_streamr.sourcer rvaluer/r1r>poss rrzScriptBinding.checksyntaxOs^!Z22444 U//11    ... (D ! ! QVVXXF                F??^^GU33F^^E511F  $fRjCJJ..e^F,| ... 368V44  $ $\ 2 2 2 2]J7   %++OuO8OCUHb116QFUHb116QF{{! -6!80DDC  ) )$ 4 4 4 MM-3 7 7 7555  $ $\ 2 2 2 2 2   $ $\ 2 2 2 2s=BBBD''G >BGG#G  G##G:c0||dS)NT customize)run_module_event)rrs rrun_custom_eventzScriptBinding.run_custom_eventms$$Ud$;;;rFrSc tjr!tj|jz dkrdSt |jtjr |jj dS| }|sdS| |}|sdS| |sdS|rGd|jd}t|jj ||jj}|sdS|r|ngdf\|_}|jj}t(jr|r|d|t.j|} |g} |jr | |jz } |d |d | d | d ||||dS) ayRun the module after setting up the environment. First check the syntax. Next get customization. If OK, make sure the shell is active and then transfer the arguments, set the run environment's working directory to the directory of the module being executed and also add that directory to its sys.path if not already included. g?rz Customize z Run)rTF)with_cwdrzif 1: __file__ = zi import sys as _sys from os.path import basename as _basename argv = z if (not _sys.argv or _basename(_sys.argv[0]) != _basename(__file__) or len(argv) > 1): _sys.argv = argv import os as _os _os.chdir(z:) del _sys, argv, _basename, _os )r isCocoaTktime perf_counterrrr rrrrrrr short_titlerrArresultinterpruse_subprocessrestart_subprocessospathdirname runcommandprepend_syspathruncode) rrrTrcodetitlerun_argsrestartr^rcargvs rrUzScriptBinding.run_module_eventps     4#4#6#6#BS#H#H7 dlF$7 8 8  L  " " $ $ $7##%% 7)) 7}}X&& 7  A!9!9!;!;AAAE %*.-9999?  w-6!FRJ w"  ! 7g 7  % %"X & 7 7 7'//(++z = " DM !D             x((( twrc|jjj}|jst jdddd}|r"|r |jjdng|}|jj |r1|jjd|jjj}nd}|S)aGet source filename. If not saved, offer to save (or create) file The debugger requires a source file. Make sure there is one, and that the current version of the source buffer has been saved. If the user declines to save or cancels the Save As dialog, return None. If the user has configured IDLE for Autosave, the file will be silently saved if it already exists and is dirty. mainGeneralautosavebool)typeN) r ior get_savedr GetOptionsaveask_save_dialogr focus_set)rrroconfirms rrzScriptBinding.getfilenames(/I363==26,2CEEErctj|||jj|jjt j|_dS)N)r|)r showerrorr rrwrZr[r)rrhrzs rr*zScriptBinding.errorboxsJUGDL4EFFFF ##%%%%'' rN) __name__ __module__ __qualname__rr rrrVrUrrvr*rrr r $s   $333<<<<4977777r6(((((rr __main__)rmz idlelib.idle_test.test_runscript) verbosity)__doc__rarrZr"tkinterridlelib.configridlelibrr idlelib.queryrrr-r runittestrmrrrrs    ############l(l(l(l(l(l(l(l(^ zD +q::::::r