Your IP : 216.73.216.160
�
��f�c@s�dZddlZddlZddlZddlZddlZddljZddl m
Z
ddlmZm
Z
ddlmZddlmZdZGdd �d �ZdS(
u?Extension to execute code outside the Python shell window.
This adds the following commands:
- Check module does a full syntax check of the current module.
It also runs the tabnanny to catch any inconsistent tabs.
- Run module executes 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.
XXX GvR Redesign this interface (yet again) as follows:
- Present a dialog box for ``Run Module''
- Allow specify command line arguments in the dialog box
iN(uEditorWindow(uPyShellu IOBinding(uidleConf(u
macosxSupportu/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.
cBs�|EeZdZddddgfgZdd�Zdd �Zd
d�Zdd
�Zdd�Z dd�Z
dd�Zdd�Zdd�Z
dS(u
ScriptBindingurunuCheck Moduleu<<check-module>>u
Run Moduleu<<run-module>>cCsS||_|jj|_|jj|_tj�rO|jjjd|j�ndS(Nu<<run-module-event-2>>(ueditwinuflisturootu
macosxSupporturunningAsOSXAppu
text_frameubindu_run_module_event(uselfueditwin((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyu__init__1s
uScriptBinding.__init__cCs@|j�}|sdS|j|�s)dS|j|�s<dSdS(Nubreak(ugetfilenameuchecksyntaxutabnanny(uselfueventufilename((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyucheck_module_event;su ScriptBinding.check_module_eventcCs�tj|���}ytjtj|j��Wn�tjk
r�}z?|\}\}}|jj|�|j dd|�dSWYdd}~XnRtjk
r�}z/|jj|j��|j dt
�dSWYdd}~XnXWdQXdS(NuTabnanny Tokenizing ErroruToken Error: %suTab/space errorFT(utokenizeuopenutabnannyuprocess_tokensugenerate_tokensureadlineu
TokenErrorueditwinugotolineuerrorboxuFalseuNannyNagu
get_linenouindent_messageuTrue(uselfufilenameufumsgumsgtxtulinenoustartunag((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyutabnannyDs uScriptBinding.tabnannyc
!Cs�|jj�|_}|j�}|j|j�t|d��}|j�}WdQXd|kr�|jdd�}|jdd�}n|r�|dt d�kr�|d}n|j
}|j}|jddd�z�yt
||d �SWn�tttfk
r�}z�t|d
d�p'|p'd} t|d
d�p?d}
t|dd�pWd}|dkrs|
d7}
nd|
d|df}|j||�|jdd| �dSWYdd}~XnXWd|j|�XdS(Nurbs
s
s
iuERRORu1.0uenduexecumsguu<no detail available>ulinenouoffsetiu0.0 + %d lines + %d charsuSyntaxErroru%-20si����F(uflistu
open_shellushelluget_warning_streamuset_warning_streamustderruopenureadureplaceuordueditwinutextu
tag_removeucompileuSyntaxErroru
OverflowErroru
ValueErrorugetattrucolorize_syntax_erroruerrorboxuFalse(
uselfufilenameushellusaved_streamufusourceueditwinutextuvalueumsgulinenouoffsetupos((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyuchecksyntaxVs4
uScriptBinding.checksyntaxcsCtj�r2�jjjd�fdd��dS�j|�SdS(Ni�cs�jjjd�S(Nu<<run-module-event-2>>(ueditwinu
text_frameuevent_generate((uself(u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyu<lambda>|su0ScriptBinding.run_module_event.<locals>.<lambda>ubreak(u
macosxSupporturunningAsOSXAppueditwinu
text_frameuafteru_run_module_event(uselfuevent((uselfu:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyurun_module_eventts
uScriptBinding.run_module_eventcCs�|j�}|sdS|j|�}|s/dS|j|�sBdS|jj}tjrj|jdd�nt j
j|�}|jdj
d|d|��|j|�|j|�dS(uXRun the module after setting up the environment.
First check the syntax. 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.
ubreakuwith_cwduzif 1:
__file__ = {filename!r}
import sys as _sys
from os.path import basename as _basename
if (not _sys.argv or
_basename(_sys.argv[0]) != _basename(__file__)):
_sys.argv = [__file__]
import os as _os
_os.chdir({dirname!r})
del _sys, _basename, _os
ufilenameudirnameF(ugetfilenameuchecksyntaxutabnannyushelluinterpuPyShelluuse_subprocessurestart_subprocessuFalseuosupathudirnameu
runcommanduformatuprepend_syspathuruncode(uselfueventufilenameucodeuinterpudirname((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyu_run_module_event�s"
uScriptBinding._run_module_eventcCs�|jjj}|jj�s�tjddddd�}|r[|r[|jjjd�q�|j�}|jj j
�|r�|jjjd�|jjj}q�d}n|S(u�Get 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.
umainuGeneraluautosaveutypeuboolN(ueditwinuioufilenameu get_saveduidleConfu GetOptionusaveuNoneuask_save_dialogutextu focus_set(uselfufilenameuautosaveuconfirm((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyugetfilename�s uScriptBinding.getfilenamec Cs?dd
d}tjddd|dtjd |jj�}|S(NuSource Must Be Saved
iu uOK to Save?utitleuSave Before Run or Checkumessageudefaultumasteru (utkMessageBoxuaskokcanceluOKueditwinutext(uselfumsguconfirm((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyuask_save_dialog�s uScriptBinding.ask_save_dialogcCs0tj||d|jj�|jjj�dS(Numaster(utkMessageBoxu showerrorueditwinutextu focus_set(uselfutitleumessage((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyuerrorbox�suScriptBinding.errorboxN(uCheck Moduleu<<check-module>>(u
Run Moduleu<<run-module>>(u__name__u
__module__u__qualname__uNoneumenudefsu__init__ucheck_module_eventutabnannyuchecksyntaxurun_module_eventu_run_module_eventugetfilenameuask_save_dialoguerrorbox(u
__locals__((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyu
ScriptBinding*s
(u
ScriptBinding(u__doc__uosureustringutabnannyutokenizeutkinter.messageboxu
messageboxutkMessageBoxuidlelib.EditorWindowuEditorWindowuidlelibuPyShellu IOBindinguidlelib.configHandleruidleConfu
macosxSupportuindent_messageu
ScriptBinding(((u:/opt/alt/python33/lib64/python3.3/idlelib/ScriptBinding.pyu<module>s
?>