Sindbad~EG File Manager
�
&ΜgQ ���dZddlZddlZddlZddlZddlmZddlmZddl m
Z
ddl mZddlm
Z
ddl mZd ZGd
�d�Zedk(rdd
lmZedd��yy)a�Execute 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.
c�H�eZdZd�Zd�Zd�Zd�Zd�Zdd�d�Zd �Z d
�Z
d�Zy)
�
ScriptBindingc��||_|jj|_|jj|_g|_d|_y)Ng)�editwin�flist�root�cli_args�perf)�selfrs �./usr/local/lib/python3.12/idlelib/runscript.py�__init__zScriptBinding.__init__&s;������\�\�'�'��
��L�L�%�%�� ���
��� �c��t|jtj�r%|jjj�y|j
�}|sy|j|�sy|j|�syy)N�break) �
isinstancerr�OutputWindow�text�bell�getfilename�checksyntax�tabnanny)r�event�filenames r�check_module_eventz ScriptBinding.check_module_event0sf���d�l�l�F�$7�$7�8��L�L���"�"�$���#�#�%��������)���}�}�X�&��rc�X�tj|�5} tjtj|j
�� ddd�y#tj$rT}|j\}\}}|jj|�|jdd|z�Yd}~ddd�yd}~wtj$rQ}|jj|j��|jdt�Yd}~ddd�yd}~wwxYw#1swYyxYw)NzTabnanny Tokenizing ErrorzToken Error: %sFzTab/space errorT)�tokenize�openr�process_tokens�generate_tokens�readline�
TokenError�argsr�gotoline�errorbox�NannyNag�
get_lineno�indent_message)rr�f�msg�msgtxt�lineno�start�nags rrzScriptBinding.tabnanny=s���
�]�]�8�
$��
��'�'��(@�(@����(L�M�%����&�&�
�*-�(�(�'��������%�%�f�-��
�
�9�/�&�8�:��%�
$���$�$�
����%�%�c�n�n�&6�7��
�
�/��@��%�
$��
��%��sA�D �2A�D�'AB6�)D �6D�?D�D �D�D � D)c��|jj�x|_}|j�}|j |j
�t
|d�5}|j�}ddd�dvr$|jdd�}|jdd�}|r|dtd�k7r|dz}|j}|j}|jddd� t||d �|j |�S#1swY��xYw#ttt f$r�}t#|d
d�xs|xsd} t#|d
d�xsd}
t#|dd�xsd}|dk(r|
dz
}
d|
dz
|dz
fz}|j%||�|j'dd| z�Yd}~|j |�yd}~wwxYw#|j |�wxYw)N�rb�
s
�
����ERRORz1.0�end�execr/�z<no detail available>r1��offsetrz0.0 + %d lines + %d chars�SyntaxErrorz%-20sF)r
�
open_shell�shell�get_warning_stream�set_warning_stream�stderrr#�read�replace�ordrr�
tag_remove�compiler?�
OverflowError�
ValueError�getattr�colorize_syntax_errorr*)
rrrA�saved_streamr.�sourcerr�valuer/r1r>�poss
rrzScriptBinding.checksyntaxOs���!�Z�Z�2�2�4�4��
�U��/�/�1��
� � ����.�
�(�D�
!�Q��V�V�X�F�"��F�?��^�^�G�U�3�F��^�^�E�5�1�F��f�R�j�C��J�.��e�^�F��,�,���|�|��������.� 3��6�8�V�4�
�$�$�\�2�1"�
!���]�J�7� ��%���+�O�u�O�8O�C��U�H�b�1�6�Q�F��U�H�b�1�6�Q�F���{��!���-����6�!�8�0D�D�C��)�)�$��4��M�M�-��3��7���$�$�\�2�� ��
�$�$�\�2�s7�C<�D�<D�F,�A5F'�F/�'F,�,F/�/Gc�(�|j|d��S)NT�� customize)�run_module_event)rrs r�run_custom_eventzScriptBinding.run_custom_eventms���$�$�U�d�$�;�;rFrSc ��tj�r%tj�|jz
dkryt|jtj�r%|jjj�y|j�}|sy|j|�}|sy|j|�sy|rWd|jj��d�}t|j j||j"��j$}|sy|rngdf\|_}|j j&}t(j*r|r|j-d|��t.j0j3|�} |g}
|j"r|
|j"z
}
|j5d |�d
|
�d| �d��|j7|�|j9|�y)
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� isCocoaTk�time�perf_counterrrrrrrrrrr�short_titlerrAr�result�interpr�use_subprocess�restart_subprocess�os�path�dirname�
runcommand�prepend_syspath�runcode)rrrTr�code�title�run_args�restartr^rc�argvs rrUzScriptBinding.run_module_eventps�������4�#4�#4�#6����#B�S�#H���d�l�l�F�$7�$7�8��L�L���"�"�$���#�#�%��������)�����}�}�X�&��� ����!9�!9�!;� <�D�A�E� ������%�*.�-�-�9�9?��
���-6��R��J���
�w����"�"���!�!�g��%�%�"�X�
&�
7��'�'�/�/�(�+���z���=�=��D�M�M�!�D����� �|�$��8���k�"�� � ���x�(� ���t��rc��|jjj}|jj�s�t j
dddd��}|r)|r'|jjj
d�|S|j�}|jjj�|rG|jjj
d�|jjj}|Sd}|S)a�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.
�main�General�autosave�bool)�typeN)
r�ior� get_savedr� GetOption�save�ask_save_dialogr� focus_set)rrro�confirms rrzScriptBinding.getfilename�s����<�<�?�?�+�+���|�|�%�%�'��)�)�&�)�*4�6�C�H��H������$�$�T�*����.�.�0�����!�!�+�+�-���L�L�O�O�(�(��.�#�|�|���7�7�H��� $�H��rc��d}tjd|tj|jj��}|S)Nz%Source Must Be Saved
OK to Save?zSave Before Run or Check)rh�message�default�parent)r�askokcancel�OKrr)rr/rxs rrvzScriptBinding.ask_save_dialog�s9��>���(�(�/I�36�3=�=�=�26�,�,�2C�2C�E���rc���tj|||jj��|jjj �tj�|_y)N)r|)r� showerrorrrrwrZr[r)rrhrzs rr*zScriptBinding.errorbox�sD�����U�G�D�L�L�4E�4E�F������#�#�%��%�%�'�� rN)�__name__�
__module__�__qualname__rr rrrVrUrrvr*�rrr
r
$s5�����$3�<<�49�7�r�6�(rr
�__main__)rmz idlelib.idle_test.test_runscript�)� verbosity)�__doc__rarrZr"�tkinterr�idlelib.configr�idlelibrr�
idlelib.queryrrr-r
r��unittestrmr�rr�<module>r�s[��
�
�����#���#����l(�l(�^�z���� +�q�:�r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists