Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/editor.cpython-36.opt-2.pyc

3

��2a��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Tddl
mZddlj
ZddljZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlm Z dZ!dej"�Z#e$jdkZ%dd�Z&Gdd�de'�Z(dd�Z)dd�Z*Gdd�de'�Z+dd�Z,dd d!d"�Z-d#d$�Z.d%d&�Z/d'd(�Z0e1d)k�r�dd*l2m3Z3e3d+d,d-d.�dd/l4m5Z5e5e0�dS)0�N)�*)�	Scrollbar)�idleConf)�configdialog)�grep)�help)�
help_about)�macosx)�MultiCallCreator)�pyparse)�query)�replace)�search)�window�z (%s)�darwincCsbtj\}}}}}d||f}|d|f7}|dkrB|d|f7}n|dkr^|d|d|f7}|S)Nz%s%sz%s�	candidatezrc%s�finalr)�sys�version_info)�major�minor�micro�level�serial�release�r�+/opt/alt/python36/lib64/python3.6/editor.py�_sphinx_version!src@s�eZdZddlmZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlm Z ddl!m"Z"e#j$�Z%dZ&d�dd�Z'dd�Z(dd�Z)dd�Z*dd�Z+d�dd�Z,d�d�d�d�d�d�d�gZ-d,d-�Z.d.d/�Z/d0d1�Z0d2d3�Z1dZ2d4d5�Z3d�gZ4d8d9�Z5d:d;�Z6d<d=�Z7d>d?�Z8d�d@dA�Z9�ddBdC�Z:�ddDdE�Z;�ddFdG�Z<dHdI�Z=dJdK�Z>dLdM�Z?�ddNdO�Z@�ddPdQ�ZAdRdS�ZBdTdU�ZCdVdW�ZDdXdY�ZEdZd[�ZFd\d]�ZGd^d_�ZHd`da�ZIdbdc�ZJddde�ZKdfdg�ZL�ddhdi�ZM�ddjdk�ZN�ddldm�ZOdndo�ZPdpdq�ZQdrds�ZRdtdu�ZSdvdw�ZTdxdy�ZUdzd{�ZVd|d}�ZWeXjYeXjZd~Z[dd��Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zb�dd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zk�d	d�d��Zld�d��Zm�d
d�d��Znd�d��Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��Zvd�d��Zwd�d�iZxd�d��Zy�dd�d��Zz�dd�d��Z{d�d��Z|�d
d�dÄZ}�dd�dńZ~d�dDŽZd�dɄZ�d�d˄Z�d�d̈́Z��dd�dЄZ�d�d҄Z�d�dԄZ�d�dքZ�d�d؄Z�d�dڄZ�d�d܄Z�d�dބZ�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�dS(�EditorWindowr)�
Percolator)�ColorDelegator�color_config)�
UndoDelegator)�	IOBinding�encoding)�mainmenu)�MultiStatusBar)�AutoComplete)�
AutoExpand)�Calltip)�CodeContext)�FormatParagraph)�
ParenMatch)�Rstrip)�Squeezer)�
ZoomHeightNcCsnddlm}tjdk�rtjjtjdd�}tj	j
d�rvddtjdd�}tjjd	�r^d
}q�d}tjj||dd�}nVtj	dd�dkr�tjjtjdd
t
��}	tjj|	�r�|	}ntj	dkr�tjjtjd�}tjj|�}tjj|��r|t_tj	dk�rdtjt_ndtjdd�t_||_|�p*|j}||_t|�|_tj||jd�|_}
|�rl|j|_|j|j_ni|_i|j_tjjtjd�|_d|_t|
�|_ }t!|dd�|_"}tj#ddddd�|_$dddd|j$d tj#ddd!dd�d"�}
t%t&�|f|
�|_'}|j'|j_(|j)�|j*�|jj+d#|j,�|jj-d$|j.�t/j0��rp|j-d$|j.�|j-d%|j1�|j-d&|j1�n|j-d'|j1�|j-d(|j2�|j-d)|j2�|j-d*|j2�|j-d+|j3�|j-d,|j4�|j-d-|j5�|j-d.|j6�|j-d/|j7�|j-d0|j8�|j-d1|j9�|j-d2|j:�|j-d3|j;�|j-d4d5d6��|j-d7|j<�|j-d8|j=�|j-d9|j>�|j-d:|j?�|j-d;|j@�|j-d<|jA�|j-d=|jB�|j-d>|jC�|j-d?|jD�|j-d@|jE�|j-dA|jF�|j-dB|jG�|j-dC|jH�|j-dD|jI�|j-dE|jJ�|j-dF|jK�|j-dG|jL�|j-dH|jM�|j-dI|jN�|j-dJ|jOd��|j-dK|jOdL��|j-dM|jP�|j-dN|jQ�|j-dO|jR�|�r�||j|<|�r�||jS|<|j-dP|jT�|j-dQ|jjU�|j-dR|jV�|j-dS|jW�|j-dT|jX�|jY�|jZ|dU<|j[t\t]dV�|j^|dW<tj_|jdd�|dX<|j[t`tadLdY�|j[tbtadLdY�|jc�tj#ddZd[d\d�}||_dd]|_e|je|_f|jg�d^|_hd}|_i|jj|�|_k}|jl�|_m}|jn|�|jo|_o|jp|_p|jq|jr�|js|�|_t}|ju|jv�d^|_w|jxd^�d|_y|�rjtjjz|��rZtjj|��rZ|j{|��rjdb|_w|j||�}|jx|�n|j}|�db|_w|j~�|jr�|j�|j��|j�j�dc�}|�r�|j�dd�}|dk�r�d~}|dk�r�|j��|dL}||_�tj�|j��t�j�|_�t�j�|_�t�j�|_�|j�dedf�|j�dgdhdidj�|j�dkdl�|j�dmdn�|j�dodndpdq�|j�|�}|j-de|j��|j-dg|j��|j-dr|j��|j-ds|j�|�j��|j-dt|j�|�j��|j�|�}|j-du|j��|j-do|j��||�}|j-dv|j��|j-dw|j��|j-dx|j�|�j��|j�|�}|j-dk|j��|j-dm|j��|j-dy|j��|j-dz|j�|�j��|j-d{|j�|�j��|j�|�}|j-d||j��dS)Nr)�
ScriptBindingZDocz
index.html�linuxzpython-docs-z%s.%s.%s�z/var/www/html/python/z/var/www/html/python/index.htmlz/usr/share/doc/�winzPython%s.chmrz0Resources/English.lproj/Documentation/index.htmlzfile://zhttps://docs.python.org/%d.%d/�)�menuzrecent-files.lst��vbar)�name�mainr�width�int)�type�text�ZnoneZ
wordprocessor�height)r9Zpadx�wrapZhighlightthicknessr;Ztabstyler@ZWM_DELETE_WINDOWz<<close-window>>z<Control-Button-1>z<2>z<3>z<MouseWheel>z
<Button-4>z
<Button-5>z<<cut>>z<<copy>>z	<<paste>>z<<center-insert>>z<<help>>z<<python-docs>>z<<about-idle>>z<<open-config-dialog>>z<<open-module>>z<<do-nothing>>cSsdS)N�breakr)�eventrrr�<lambda>�sz'EditorWindow.__init__.<locals>.<lambda>z<<select-all>>z<<remove-selection>>z<<find>>z<<find-again>>z<<find-in-files>>z<<find-selection>>z<<replace>>z
<<goto-line>>z<<smart-backspace>>z<<newline-and-indent>>z<<smart-indent>>z<<indent-region>>z<<dedent-region>>z<<comment-region>>z<<uncomment-region>>z<<tabify-region>>z<<untabify-region>>z<<toggle-tabs>>z<<change-indentwidth>>z<Left>z<Right>�z<<del-word-left>>z<<del-word-right>>z<<beginning-of-line>>z<<open-new-window>>z<<close-all-windows>>z<<open-class-browser>>z<<open-path-browser>>z<<open-turtle-demo>>�command)�side�fillZyscrollcommand�font)rGrH�expand�Indentz
use-spaces�boolrF�2���@KLTr�endz<<autocomplete>>z	<Key-Tab>z<<try-open-completions>>z<KeyRelease-period>z<KeyRelease-slash>z<KeyRelease-backslash>z<<try-open-calltip>>z<KeyRelease-parenleft>z<<refresh-calltip>>z<KeyRelease-parenright>z<<paren-closed>>z<KeyRelease-bracketright>z<KeyRelease-braceright>z<<force-open-completions>>z<<expand-word>>z<<format-paragraph>>z<<flash-paren>>z<<check-module>>z<<run-module>>z
<<do-rstrip>>z<<force-open-calltip>>z<<zoom-height>>z<<toggle-code-context>>z<<squeeze-current-text>>)rMrNrO���)�Zidlelib.runscriptr1r�help_url�os�path�joinr�base_prefix�platform�countr�isdirr�isfile�normpath�flist�root�Menu�menubarrZListedToplevel�top�vars�tkinter_varsZinversedict�
instance_dictrZuserdir�recent_files_path�prompt_last_line�Frame�
text_framerr8�	GetOptionr;r
ZTextr>Zfocused_widget�
createmenubar�apply_bindingsZprotocol�close�bind�close_eventr	ZisAquaTk�right_menu_event�mousescroll�cut�copy�paste�center_insert_event�help_dialog�python_docs�about_dialog�
config_dialog�open_module_event�
select_all�remove_selection�
find_event�find_again_event�find_in_files_event�find_selection_event�
replace_event�goto_line_event�smart_backspace_event�newline_and_indent_event�smart_indent_event�indent_region_event�dedent_region_event�comment_region_event�uncomment_region_event�tabify_region_event�untabify_region_event�toggle_tabs_event�change_indentwidth_event�move_at_edge_if_selection�
del_word_left�del_word_right�
home_callback�dict�new_callbackZclose_all_callback�open_module_browser�open_path_browser�open_turtle_demo�set_status_bar�handle_yview�pack�RIGHT�Y�set�GetFontZLEFTZBOTHZTOPZ	focus_set�usetabs�tabwidth�indentwidth�set_notabs_indentwidth�context_use_ps1�num_context_linesr �perr#�undo�insertfilter�undo_block_start�undo_block_stopZset_saved_change_hook�saved_change_hookr$�ioZset_filename_change_hook�filename_change_hookZ	good_load�set_indentation_params�color�exists�loadfile�ispythonsourceZset_filename�ResetColorizer�update_recent_files_list�load_extensions�menudict�get�index�
add_separator�	wmenu_endZregister_callback�postwindowsmenu�tkMessageBox�askyesno�tkSimpleDialog�
askinteger�	showerror�	event_addr(Zautocomplete_eventZtry_open_completions_eventZforce_open_completions_eventr)Zexpand_word_eventr,Zformat_paragraph_eventr-Zflash_paren_eventZparen_closed_eventZcheck_module_eventZrun_module_eventr.Z	do_rstripr*Ztry_open_calltip_eventZrefresh_calltip_eventZforce_open_calltip_eventr0Zzoom_height_eventr+Ztoggle_code_context_eventr/Zsqueeze_current_text_event)�selfr\�filename�keyr]r1ZdochomeZpyverZbasepathZchmfiler`rgr8Ztext_optionsr>Z	usespacesr�r�r��	is_py_srcr6rPZautocompleteZ
parenmatchZ
scriptbindingZctipZsqueezerrrr�__init__As�






















zEditorWindow.__init__cCsnt|t�r`y|j|j�}WnDtk
r^y|j|j�}Wntk
rX|jd�}YnXYnXtjdd|�S)Nz	iso8859-1u[𐀀-􏿿]u�)�
isinstance�bytes�decode�filesystemencoding�UnicodeDecodeErrorr%�re�sub)r�r�rrr�_filename_to_unicodeDs
z!EditorWindow._filename_to_unicodecCs|jj�\}}|jj|�dS)NrB)r�Zdefaultfilenamer\�new)r�rC�dirname�basenamerrrr�SszEditorWindow.new_callbackcCs�|jd@dkr|jdkrdS|jjd�rd|jjddd�rd|jjddd�rdt|jjd�jd�d	�}n:|jjdd�}x*tt	|��D]}||dkr�Pq�Wt	|�}t|jjd�jd�d	�}||kr�d}d
t
|�d}|jd	@dkr�|jjddd�n�|jjd��s|jjdd�n@|jj|jjd�d|jjd���rD|jjdd�n|jjdd�|jj|�}|jjd�}|jj|d|��r�||}}|jjddd�|jj
d||�|jjd|�|jjd�dS)N�rZHomeZiomarkz<=zinsert lineendzinsert linestart�.rE� �	�insertzinsert linestart+�c�selz1.0rPz	sel.firstZ	my_anchor�<zsel.last�>rB)r�r�)�stateZkeysymr>r��comparer<�splitr��range�len�str�
tag_remove�mark_set�tag_add�see)r�rCZinsertpt�lineZlineat�dest�first�lastrrrr�Xs@
zEditorWindow.home_callbackcCs�|j|j�|_t|jdddd�}tjdkr<|jjddtd�|jjdd	td�|jjd
dtd�|jjt	t
d�|jt	t
d�|jjd
|j
�|jjd
dd�|jj|j
�dS)NrEZgrey75)r@ZborderwidthZ
backgroundrZ	_padding1z    )rG�columnzCol: ?r�zLn: ?)rGrHz<<set-line-and-column>>z<KeyRelease>z<ButtonRelease>)r'r`�
status_barrfrrW�	set_labelr�r�ZBOTTOM�Xr>rl�set_line_and_columnr�Z
after_idle)r��seprrrr��s
zEditorWindow.set_status_barcCs>|jjt�jd�\}}|jjdd|�|jjdd|�dS)Nr�r�zCol: %sr�zLn: %s)r>r�ZINSERTr�r�r�)r�rCr�r�rrrr��sz EditorWindow.set_line_and_column�file�_File�edit�_Edit�format�F_ormat�run�_Run�options�_Optionsr�_Windowr�_HelpcCs�|j}i|_}xD|jD]:\}}t|�\}}t||dd�||<}|j|||d�qWtj�r�t|ddd�|d<}|jd|d�|j�t|jdd�|_	|jd	j
d
dd|j	d�|jd
jt�|_
|j�dS)Nr)r9�tearoff)�labelr6�	underlineZappleZapplicationZIDLE)r�r6)r�r�r3zRecent Files)r�r�r6r)r_r��
menu_specs�prepstrr^Zadd_cascader	Z
isCarbonTk�
fill_menus�recent_files_menuZinsert_cascader��END�base_helpmenu_length�reset_help_menu_entries)r�Zmbarr�r9r�r�r6rrrri�s"

zEditorWindow.createmenubarcCsJ|jd}|jd�}|dkr d}||jkr<|j|jd|�tj|�dS)NrrPrErQ)r�r�r��deleterZadd_windows_to_menu)r�r6rPrrrr��s


zEditorWindow.postwindowsmenucGsR|dkr<t|d�}t|jd�|�|jd�}d}|df}|jj|f|��dS)NZmovetorrPz@0,0Zscroll�unitsrB)�float�round�	getlinenor>�yview)r�rC�argsZfraction�linesrrrr��szEditorWindow.handle_yviewcCs@tj|jdktj|jdki}||jr*dnd}|jj|d�dS)Nrr�r?rrB���)Z	EventTypeZ
MouseWheelZdeltaZButtonZnumr=r>Zyview_scroll)r�rCZuprrrrro�s
zEditorWindow.mousescrollc	
Cs�|jjdd|j|jf�|js(|j�|j}||_tjdd�dk}|rX|jj	dd�xX|j
D]N}y|\}}}Wntk
r�w`YnX|dkr�q`t||��}|j
||d�q`W|j|j|j�|r�|jj	dd�d	S)
Nr�z@%d,%dr3r4Zarrow)Zcursor)r�ZibeamrB)r>r��x�y�rmenu�
make_rmenurCrrW�config�rmenu_specs�
ValueError�getattrZentryconfigureZtk_popupZx_rootZy_root)	r�rCrZiswin�itemr��	eventnameZverify_stater�rrrrn�s*zEditorWindow.right_menu_event�Close�<<close-window>>cCsjt|jdd�}xP|jD]F}|d|d}}|dk	rT|j|fdd�}|j||d�q|j�qW||_dS)Nr)r�rEcSs|j|�dS)N)�event_generate)r>rrrrrFsz(EditorWindow.make_rmenu.<locals>.command)r�rF)r^r>r�add_commandr�r)r�rrr�rrFrrrr
�szEditorWindow.make_rmenucCs|j�S)N)�rmenu_check_copy)r�rrr�rmenu_check_cutszEditorWindow.rmenu_check_cutcCs6y|jjd�}Wntk
r$dSX|r.dSdSdS)Nz	sel.first�disabled�normal)r>r��TclError)r�Zindxrrrrs
zEditorWindow.rmenu_check_copycCs6y|jjjd|jd�Wntk
r,dSXdSdS)Nztk::GetSelectionZ	CLIPBOARDrr)r>�tk�callr)r�rrr�rmenu_check_pastes
zEditorWindow.rmenu_check_pastecCstj|j�dS)NrB)rZAboutDialogr`)r�rCrrrrvszEditorWindow.about_dialogcCstj|jd�dS)NZSettingsrB)rZConfigDialogr`)r�rCrrrrw$szEditorWindow.config_dialogcCs"|jr|j}n|j}tj|�dS)NrB)r]r`rZ
show_idlehelp)r�rC�parentrrrrt*s

zEditorWindow.help_dialogcCsntjdd�dkr^ytj|j�Wqjtk
rZ}ztjdt|�|j	d�WYdd}~XqjXnt
j|j�dS)Nr3r4zDocument Start Failure)�title�messager rB)rrWrS�	startfilerR�OSErrorr�r�r�r>�
webbrowser�open)r�rC�whyrrrru4s$zEditorWindow.python_docscCs|jjd�dS)Nz<<Cut>>rB)r>r)r�rCrrrrp?szEditorWindow.cutcCs |jjd�sdS|jjd�dS)Nr�z<<Copy>>rB)r>Z
tag_rangesr)r�rCrrrrqCszEditorWindow.copycCs|jjd�|jjd�dS)Nz	<<Paste>>r�rB)r>rr�)r�rCrrrrrJszEditorWindow.pastecCs.|jjddd�|jjdd�|jjd�dS)Nr�z1.0zend-1cr�rB)r>r�r�r�)r�rCrrrryOszEditorWindow.select_allcCs |jjddd�|jjd�dS)Nr�z1.0rPr�rB)r>r�r�)r�rCrrrrzUszEditorWindow.remove_selectioncs*|jj�|jj�d�����fdd�}|S)N�sel.first+1c�sel.last-1ccsB|jd@dkr>y�d��d���Wntk
r<YnXdS)Nr?rz	sel.firstr�)r�r)rC)�
edge_index�edges_table�self_text_index�self_text_mark_setrr�move_at_edgeesz<EditorWindow.move_at_edge_if_selection.<locals>.move_at_edge)r(r))r>r�r�)r�r*r.r)r*r+r,r-rr�Zs
z&EditorWindow.move_at_edge_if_selectioncCs|jjd�dS)Nz
<Meta-Delete>rB)r>r)r�rCrrrr�nszEditorWindow.del_word_leftcCs|jjd�dS)Nz<Meta-d>rB)r>r)r�rCrrrr�rszEditorWindow.del_word_rightcCstj|j�dS)NrB)r�findr>)r�rCrrrr{vszEditorWindow.find_eventcCstj|j�dS)NrB)rZ
find_againr>)r�rCrrrr|zszEditorWindow.find_again_eventcCstj|j�dS)NrB)rZfind_selectionr>)r�rCrrrr~~sz!EditorWindow.find_selection_eventcCstj|j|j|j�dS)NrB)rr>r�r\)r�rCrrrr}�sz EditorWindow.find_in_files_eventcCstj|j�dS)NrB)r
r>)r�rCrrrr�szEditorWindow.replace_eventcCsT|j}tjdd|d�}|dkr"dS|dkr6|j�dS|jdd|�|jd�dS)NZGotozGo to line number:)r rBrr�z%d.0)r>r�r��bellr�r�)r�rCr>�linenorrrr��s

zEditorWindow.goto_line_eventc
Cspy|jjdd�j�}Wntk
r.d}YnXtj|jdd|�j}|dk	rl|jr`|jj|�n|j	j
|�|S)Nz	sel.firstzsel.lastr7zOpen ModulezAEnter the name of a Python module
to search on sys.path and open:)r>r��striprrZ
ModuleName�resultr\r&r�r�)r�r9Z	file_pathrrr�open_module�s
zEditorWindow.open_modulecCs|j�dS)NrB)r4)r�rCrrrrx�szEditorWindow.open_module_eventcCsJ|jj}|jjdko|s,|j�}|dkr,dSddlm}|j|j|�dS)NZPyShellEditorWindowrBr)�browser)	r�r��	__class__�__name__r4�idlelibr5Z
ModuleBrowserr])r�rCr�r5rrrr��sz EditorWindow.open_module_browsercCsddlm}|j|j�dS)Nr)�pathbrowserrB)r8r9ZPathBrowserr])r�rCr9rrrr��szEditorWindow.open_path_browsercCs&ddl}tjddg}|j|dd�dS)Nrz-cz,from turtledemo.__main__ import main; main()F)�shellrB)�
subprocessr�
executable�Popen)r�rCr;�cmdrrrr��szEditorWindow.open_turtle_democCsN|dk	rJ|dkrJ|jjdd|�|jjddd�|jjddd�|j�dS)Nrr�z%d.0r�z1.0rPz
insert +1l)r>r�r�r��center)r�r1rrr�gotoline�s
zEditorWindow.gotolinecCsb|stjj|�rdStjjtjj|��\}}tjj|�dkrBdS|jjdd�}|jd�o`d|kS)	NT�.py�.pywz1.0z1.0 lineendz#!�python)rArB)	rSrTrY�splitextr��normcaser>r��
startswith)r�r��baseZextr�rrrr��szEditorWindow.ispythonsourcecCs|jr|jj|�d|_dS)N)r\Zunregister_maybe_terminate)r�rrr�
close_hook�szEditorWindow.close_hookcCs
||_dS)N)rH)r�rHrrr�set_close_hook�szEditorWindow.set_close_hookcCs2|jr|jj|�|j�|jj|�|j�dS)N)r\Zfilename_changed_editr�r`Zupdate_windowlist_registryr�)r�rrrr��s
z!EditorWindow.filename_change_hookcCsV|jr
dS|j|jj�r"|j�|_|jrR|jj|j�|jj|j�|jj|j�dS)N)	r�r�r�r�r!r��removefilterr�r�)r�rrr�
_addcolorizer�s
zEditorWindow._addcolorizercCs,|js
dS|jj�|jj|j�d|_dS)N)r�Zremovecolorsr�rJ)r�rrr�_rmcolorizer�s

zEditorWindow._rmcolorizercCs |j�|j�tj|j�dS)N)rLrKrr"r>)r�rrrr��szEditorWindow.ResetColorizer�_cCsp|jd|�|j|�}|r6||jkr6|jd|d|�d|j|�krR|jd|�n|jd|d�|j|�dS)NZERRORz
 wordstart�
r�z+1c)r�r��
IDENTCHARSr�r�)r�r>�pos�charrrr�colorize_syntax_errors
z"EditorWindow.colorize_syntax_errorcCstj|jdd�|jd<dS)Nr:rrI)rr�r]r>)r�rrr�	ResetFontszEditorWindow.ResetFontcCs�tj�|j_}x&|j�D]\}}|jj|f|��qWxF|j�D]:}tj|�}|rBx&|j�D]\}}|jj|f|��q^WqBWdS)N)	r�GetCurrentKeySetr&�default_keydefs�itemsr>Zevent_delete�get_standard_extension_names�GetExtensionBindings)r��keydefsrC�keylist�
extensionName�xkeydefsrrr�RemoveKeybindingss
zEditorWindow.RemoveKeybindingsc
CsVtj�|j_}|j�x(|j�D]}tj|�}|r"|j|�q"Wi}xR|jjD]F}i||d<x4|dD](}|rj|d||dt|d�d<qjWqPWx�|j	D]�}|j	|}|j
t�}|dkr�q�|d7}x�td|�D]r}	|j
|	�dkr�|j|	d�}
|
r�|j|	d�}d}||k�r.|||k�r.|||}|r�t||�}
|j|	|
d�q�Wq�WdS)NrrErF�acceleratorr�r7)r^)rrTr&rUrjrWrX�menudefsr�r�r�r�r�r=Z	entrycget�get_acceleratorZentryconfig)
r�rYr[r\Z
menuEventDictr6rZmenubarItemrPr�ZaccelZitemNamerCrrr�ApplyKeybindings#s<
(



zEditorWindow.ApplyKeybindingscCs|jstjddddd�|_dS)Nr:rKz
num-spacesr<)r=)r�rrhr�)r�rrrr�Gs
z#EditorWindow.set_notabs_indentwidthcCs�tj�}|jd}|jt�}||jkr8|j|jd|�|rr|j�x,|D]$}|j|d�}|j	|d|d�qJW||jd<dS)NrrEr)r�rF)
rZGetAllExtraHelpSourcesListr�r�r�r�rr��"_EditorWindow__extra_help_callbackr)r�Z	help_listZhelpmenuZhelpmenu_length�entryr>rrrrNs



z$EditorWindow.reset_help_menu_entriescs|f�fdd�	}|S)Ncs�|jd�stjj|�}tjdd�dkrrytj|�Wq|tk
rn}ztj	dt
|��jd�WYdd}~Xq|Xn
tj
|�dS)N�www�httpr3r4zDocument Start Failure)r!r"r )rdre)rFrSrTr[rrWr#r$r�r�r�r>r%r&)�helpfiler')r�rr�display_extra_helpas
$z>EditorWindow.__extra_help_callback.<locals>.display_extra_helpr)r�rfrgr)r�rZ__extra_help_callback_sz"EditorWindow.__extra_help_callbackcs�g}tjj|j�r8t|jdddd��}|j�}WdQRX|rjtjj|�d}||kr^|j|�|jd|�g�x4|D],}d|ks�tjj|dd��rt�j	|�qtW�fd	d
�|D�}d}|dt
|��}y,t|jdddd��}|j|�WdQRXWn\tk
�rR}z>t
|jd
d��sBd|j_tjdd|jt|��|jd�WYdd}~XnXxt|jjD]h}|j}	|	jdt�xNt|�D]B\}
}|j�}|j|�}|j|�}
|	j||
d||
dd��q~W�q^WdS)N�r�utf_8r
)r%�errorsrNr�rEcsg|]}|�kr|�qSrr)�.0rT)�	bad_pathsrr�
<listcomp>sz9EditorWindow.update_recent_files_list.<locals>.<listcomp>Z1234567890ABCDEFGHIJK�w�recentfilelist_error_displayedFTzIDLE Warningz|Cannot update File menu Recent Files list. Your operating system says:
%s
Select OK and IDLE will continue without updating.)r!r"r r�)r�rFr�rQ)rSrTr�rdr&�	readlines�abspath�remover��appendr��
writelinesr$rr]rpr��showwarningr�r�r>r`rcr�rr��	enumerate�rstrip�#_EditorWindow__recent_file_callbackr)r��new_fileZrf_listZrf_list_filerTZulcharsZrf_file�err�instancer6�i�	file_nameZ
ufile_name�callbackr)rmrr�nsL



z%EditorWindow.update_recent_files_listcs|f�fdd�	}|S)Ncs�jj|d�dS)N)ZeditFile)r�r&)Z
fn_closure)r�rr�open_recent_file�sz=EditorWindow.__recent_file_callback.<locals>.open_recent_filer)r�r~r�r)r�rZ__recent_file_callback�sz#EditorWindow.__recent_file_callbackcCs�|j�}|j�}|r*|r*|d|t}n|r4|}n|r>|}nd}|pL|pL|}|j�sfd|}d|}|jj|�|jj|�dS)Nz - �Untitledz*%s*z*%s)�short_title�
long_title�_py_version�	get_savedr`Zwm_titleZwm_iconname)r�ZshortZlongr!Ziconrrrr��szEditorWindow.saved_change_hookcCs
|jj�S)N)r�r�)r�rrrr��szEditorWindow.get_savedcCs|jj|�dS)N)r��	set_saved)r��flagrrrr��szEditorWindow.set_savedcCs|jj�dS)N)r��
reset_undo)r�rrrr��szEditorWindow.reset_undocCs(|jj}|rtjj|�}nd}|j|�S)Nr�)r�r�rSrTr�r�)r�r�rrrr��s
zEditorWindow.short_titlecCs|j|jjpd�S)Nr7)r�r�r�)r�rrrr��szEditorWindow.long_titlecCs|j�dS)NrB)r?)r�rCrrrrs�sz EditorWindow.center_insert_eventr�cCsH|j}|j�\}}|j|�}||}td||d�}|jt|��dS)NrEr5)r>�getwindowlinesr�maxrr)r��markr>r`�botr1r@Znewtoprrrr?�s
zEditorWindow.centercCsN|j}|jd�}|jd�}||krF|j�dkrFt|d�}||d}||fS)Nz@0,0z@0,65535rEr@)r>rZwinfo_heightr<)r�r>r`r�r@rrrr��s

zEditorWindow.getwindowlinescCs|j}tt|j|���S)N)r>r<rr�)r�r�r>rrrr�szEditorWindow.getlinenocCs(|jj�}tjd|�}ttt|j���S)Nz(\d+)x(\d+)\+(-?\d+)\+(-?\d+))r`Zwm_geometryr��match�list�mapr<�groups)r�Zgeom�mrrr�get_geometry�s
zEditorWindow.get_geometrycCs|j�dS)NrB)rk)r�rCrrrrm�szEditorWindow.close_eventcCsH|jrD|j�s:|jj�dkr&|jj�|jj�|jj�|jj�SdS)Nr)r�r�r`r�Z	deiconify�lowerZlift�	maybesave)r�rrrr��s


zEditorWindow.maybesavecCs |j�}t|�dkr|j�|S)NZcancel)r�r��_close)r�Zreplyrrrrk�szEditorWindow.closecCs�|jjr|j|jjd�tj|j�|j�|jj�d|_d|_|j	rZ|j	jd�d|_	d|_
d|_|jj�d|_|j
j�|jr�|j�dS)N)rzF)r�r�r�rZunregister_callbackr��unload_extensionsrkr�r�r>rbr�r`ZdestroyrH)r�rrrr��s"


zEditorWindow._closecCsi|_|j�dS)N)�
extensions�load_standard_extensions)r�rrrr�szEditorWindow.load_extensionscCs4x(t|jj��D]}t|d�r|j�qWi|_dS)Nrk)r�r��values�hasattrrk)r��insrrrr�s
zEditorWindow.unload_extensionscCsHxB|j�D]6}y|j|�Wq
tdt|��tj�Yq
Xq
WdS)NzFailed to load extension)rW�load_extension�print�repr�	traceback�	print_exc)r�r9rrrr�sz%EditorWindow.load_standard_extensionscCstjdd�S)NT)Zeditor_only)rZ
GetExtensions)r�rrrrW"sz)EditorWindow.get_standard_extension_namesZZzDummyZzzdummyc	CsF|jj||�}y>ytjd|td�}Wn"ttfk
rHtj|�}YnXWn tk
rltd|��YnXt||�}t	j
|�}t|d�r�|j|j
|�||�}||j|<|�rB|j|�x�|D]|}|jdd�}x |dd�dkr�|dd�}q�Wx"|dd�d	k�r|dd�}q�W|d
}t||�r�|jj|t||��q�WdS)
Nr�)�packagez
Failed to import extension: r_�-rMrEr�r�Z_eventrQrQ)�extfilesr��	importlib�
import_module�__package__�ImportError�	TypeErrorr�rrrXr�r�r_r�rjr
r>rl)	r�r9Zfname�mod�clsrYr�ZveventZ
methodnamerrrr�)s4







zEditorWindow.load_extensioncCsJ|dkr|jj}|j}||_x(|j�D]\}}|r&|j|f|��q&WdS)N)r&rUr>rYrVr�)r�rYr>rCrZrrrrjEszEditorWindow.apply_bindingsc	Cs�|dkr|jj}|dkr |jj}|j}|j}x�|D]�\}}|j|�}|sJq2x�|D]�}|sb|j�qP|\}	}
|	dd�dk}|r�|	dd�}	t|	�\}}	t||
�}
||
fdd�}|r�|j	|
t
�}|j|	|||
|d�qP|j|	|||
d�qPWq2WdS)NrE�!cSs|j|�dS)N)r)r>rrrrrFgsz(EditorWindow.fill_menus.<locals>.command)r�r�rFr^�variable)r�r�rFr^)
r&r_rUr�r>r�r�r�r`�get_var_objZ
BooleanVarZadd_checkbuttonr)r�r_rYr�r>ZmnameZ	entrylistr6rcr�rZcheckbuttonr�r^rF�varrrrr�Ns8




zEditorWindow.fill_menuscCs&|j|�}|r|j�}|St|��dS)N)r�r��	NameError)r�r9r��valuerrr�getvarss

zEditorWindow.getvarcCs(|j||�}|r|j|�nt|��dS)N)r�r�r�)r�r9r��vartyper�rrr�setvar{szEditorWindow.setvarcCs.|jj|�}|r*|r*||j�|j|<}|S)N)rbr�r>)r�r9r�r�rrrr��s
zEditorWindow.get_var_objcCs,|jr$|jjd|�p"d|jj|�kSdSdS)NZTODO�STRINGrE)r�r>�
tag_prevrangeZ	tag_names)r�Z
text_indexrrr�is_char_in_string�szEditorWindow.is_char_in_stringcCs:y |jjd�}|jjd�}||fStk
r4dSXdS)Nz	sel.firstzsel.last)NN)r>r�r)r�r�r�rrr�get_selection_indices�sz"EditorWindow.get_selection_indicescCs|jdpt}t|�S)N�tabs)r>�TK_TABWIDTH_DEFAULTr<)r�Zcurrentrrr�get_tk_tabwidth�szEditorWindow.get_tk_tabwidthcCsB|j}|j�|kr>|jjdd|dd|jd|�}|j|d�dS)NrIZmeasurez
-displayof�n)r�)r>r�rrZmasterZ	configure)r�Znewtabwidthr>Zpixelsrrr�set_tk_tabwidth�s
zEditorWindow.set_tk_tabwidthTcCsP|r@|r@|j�}d|ko"dknr.||_|j|jkr@d|_|j|j�dS)Nr5rF)�guess_indentr�r�r�r�)r�r�Zguessr}rrrr��sz#EditorWindow.set_indentation_paramsc
CsB|j}|j�\}}|r6|r6|j||�|jd|�dS|jdd�}|dkrp|jddd�rd|jd�n|j�dS|d
d	kr�|jd�dS|j}t|j	|��}|d|j
|j
}d
}	xH||jkr�P|dd�}|	d}	t|j	|��}||kp�|dd	kr�Pq�W|j�|jd|	d�||k�r6|j
dd||�|j�dS)Nr�rBzinsert linestartr7r�z1.0z	insert-1crEz 	rz
insert-%dcr�rQrQrQ)r>r�rr�r�r�r0r�r��
expandtabsr�rer�r�r�)
r�rCr>r�r��charsr�ZhaveZwantZ
ncharsdeletedrrrr��sB


z"EditorWindow.smart_backspace_eventc

Cs�|j}|j�\}}|j�z�|rV|rVt|�t|�kr>|j|�S|j||�|jd|�|jdd�}t||j	�\}}|t
|�kr�|j||j�n>|j
r�d}n&t
|j|j	��}|j}	d|	||	}|jd|�|jd�dS|j�XdS)Nr�zinsert linestartr�r�rB)r>r�r��
index2liner�rr�r��
classifywsr�r��reindent_tor�r�r�r�r�r�)
r�rCr>r�r��prefix�raw�	effectiveZpadr�rrrr��s,

zEditorWindow.smart_indent_eventcCs�|j}|j�\}}|j��z�|r>|r>|j||�|jd|�|jdd�}dt|�}}x ||krx||dkrx|d}qZW||kr�|jdd�dS|d|�}d}x2|r�|ddkr�||jkr�|dd
�}|d}q�W|r�|jd|d�x|jd�dk�r|jd�q�W|jdd�t	|j
d��}	tj|j
|j�}
|j�s�xj|jD]`}t|	|d�}t|�d	}
|j|
d�}|
j|�|
j|j|j|
��}|dk	�s�|dk�rDP�qDW|
j|�p�d�n@|jd
d�}|�r�|d}
nd}
|j|
d�}|
j|�|
jd�|
j�}|tjk�r�|tjk�rnn|tjk�r6|jd|�nT|tjk�rR|j|
j��n8|tjk�r�|
j �dk�rz|jd|�n|j|
j!��ndS|
j"�}|jd|�|
j#��r�|j$|�n|�r�|
j%��r�|j&|�dS|j'd�|j(�XdS)Nr�zinsert linestartrz 	rErNrBzinsert - %d charsz.0Zconsolez1.0rQrQ))r>r�r�rr�r�r�r�rer�r�rZParserr�r�r�r�r�r�Zset_codeZfind_good_parse_start�_build_char_in_string_funcZset_lor�Zget_continuation_typeZC_NONEZC_STRING_FIRST_LINEZC_STRING_NEXT_LINESZ	C_BRACKETr�Zcompute_bracket_indentZC_BACKSLASHZget_num_lines_in_stmtZcompute_backslash_indentZget_base_indent_stringZis_block_openerr�Zis_block_closerr�r�r�)r�rCr>r�r�r�r}r��indentZlnor�contextZstartatZstartatindexZrawtextZbodrhr�rrrr�s�






z%EditorWindow.newline_and_indent_eventcCs||jfdd�}|S)NcSs||d|�S)Nz+%dcr)�offsetZ_startindexZ_icisrrr�inner}sz6EditorWindow._build_char_in_string_func.<locals>.inner)r�)r�Z
startindexr�rrrr�|sz'EditorWindow._build_char_in_string_funcc
Csz|j�\}}}}xTtt|��D]D}||}|rt||j�\}}	|	|j}	|j|	�||d�||<qW|j||||�dS)NrB)�
get_regionr�r�r�r�r��_make_blanks�
set_region)
r�rC�head�tailr�rrPr�r�r�rrrr��s
z EditorWindow.indent_region_eventc
Cs�|j�\}}}}xZtt|��D]J}||}|rt||j�\}}	t|	|jd�}	|j|	�||d�||<qW|j||||�dS)NrrB)	r�r�r�r�r�r�r�r�r�)
r�rCr�r�r�rrPr�r�r�rrrr��sz EditorWindow.dedent_region_eventcCsR|j�\}}}}x,tt|�d�D]}||}d|||<q"W|j||||�dS)NrEz##rB)r�r�r�r�)r�rCr�r�r�rrPr�rrrr��sz!EditorWindow.comment_region_eventcCs�|j�\}}}}xdtt|��D]T}||}|s0q|dd�dkrN|dd�}n|dd�dkrj|dd�}|||<qW|j||||�dS)Nr5z##rE�#rB)r�r�r�r�)r�rCr�r�r�rrPr�rrrr��sz#EditorWindow.uncomment_region_eventc
Cs�|j�\}}}}|j�}|dkr$dSx\tt|��D]L}||}|r2t||�\}	}
t|
|�\}}d|d|||	d�||<q2W|j||||�dS)Nr�r�rB)r��_asktabwidthr�r�r��divmodr�)
r�rCr�r�r�rr�rPr�r�r��ntabs�nspacesrrrr��s$z EditorWindow.tabify_region_eventcCs`|j�\}}}}|j�}|dkr$dSx&tt|��D]}||j|�||<q2W|j||||�dS)NrB)r�r�r�r�r�r�)r�rCr�r�r�rr�rPrrrr��sz"EditorWindow.untabify_region_eventcCsF|jddd
|jdd|jdd	|jd
�rB|j|_d|_dS)NzToggle tabsz
Turn tabs �on�offz?
Indent width �will be�
remains atz 8.z!
 Note: a tab is always 8 columns)r rrB)r�r�)r�r�)r�r�r>r�)r�rCrrrr��s

zEditorWindow.toggle_tabs_eventcCs:|jdd|j|jddd�}|r6||jkr6|jr6||_dS)NzIndent widthz6New indent width (2-16)
(Always use 8 when using tabs)r5�)r �initialvalue�minvalue�maxvaluerB)r�r>r�r�)r�rCr�rrrr��sz%EditorWindow.change_indentwidth_eventcCsn|j}|j�\}}|r8|r8|j|d�}|j|d�}n|jd�}|jd�}|j||�}|jd�}||||fS)Nz
 linestartz-1c lineend +1czinsert linestartzinsert lineend +1crN)r>r�r�r�r�)r�r>r�r�r�r�r�rrrrr��s


zEditorWindow.get_regioncCsx|j}dj|�}||kr$|j�dS|jddd�|jd|�|j�|j||�|j||�|j�|j	d|d�dS)NrNr�z1.0rPr�)
r>rUr0r�r�r�rr�r�r�)r�r�r�r�rr>�newcharsrrrr��s
zEditorWindow.set_regioncCs2|jr&t||j�\}}d|d|Sd|SdS)Nr�r�)r�r�r�)r�r�r�r�rrrr�szEditorWindow._make_blankscCsJ|j}|j�|jddd�r(|jdd�|r>|jd|j|��|j�dS)Nzinsert linestartz!=r�)r>r�r�rr�r�r�)r�r�r>rrrr�
szEditorWindow.reindent_tocCs|jdd|j|jddd�S)Nz	Tab widthzColumns per tab? (2-16)r5r�)r r�r�r�)r�r>r�)r�rrrr�szEditorWindow._asktabwidthcCsPt|j|j�j�\}}|r@|r@t||j�\}}t||j�\}}nd}}||S)Nr)�IndentSearcherr>r�r�r�)r��openerZindentedr�ZindentsmallZindentlargerrrr�$szEditorWindow.guess_indent)NNNN)N)r�r�)r�r�)r�r�)r�r�)r�r�)rr�)rr�)rrN)N)N)N)N)N)N)N)N)N)N)r�)r�)N)NN)N)N)T)�r7�
__module__�__qualname__Zidlelib.percolatorr Zidlelib.colorizerr!r"Zidlelib.undor#Zidlelib.iomenur$r%r8r&Zidlelib.statusbarr'Zidlelib.autocompleter(Zidlelib.autoexpandr)Zidlelib.calltipr*Zidlelib.codecontextr+Zidlelib.paragraphr,Zidlelib.parenmatchr-Zidlelib.rstripr.Zidlelib.squeezerr/Zidlelib.zoomheightr0r�getfilesystemencodingr�rRr�r�r�r�r�r�r�rir�r�rorrnrr
rrrrvrwrtrurprqrrryrzr�r�r�r{r|r~r}rr�r4rxr�r�r�r@r�rHrIr�rKrLr��stringZ
ascii_letters�digitsrOrRrSr]rar�rrbr�ryr�r�r�r�r�r�rsr?r�rr�rmr�rkr�r�r�r�rWr�r�rjr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr-s

+




		$.	
		%	,#j
	

	rcCstt|��S)N)r<r)r�rrrr�.sr�cCs\d}}xJ|D]B}|dkr,|d}|d}q|dkrN|d}||d|}qPqW||fS)Nrr�rEr�r)�sr�r�r�Zchrrrr�6s

r�c@s8eZdZdd�Zdd�Zejejdfdd�Zd
d�Z	dS)r�cCs(||_||_d|_|_d|_|_dS)Nr)r>r�r}�finished�blkopenline�indentedline)r�r>r�rrrr�KszIndentSearcher.__init__cCsL|jr
dS|jd}|_t|�d}|jj|dd�r:dS|jj||d�S)Nr7rEz.0z>=rPz lineend+1c)r�r}r�r>r�r�)r�r}r�rrr�readlineQszIndentSearcher.readline�class�def�for�if�try�whilec		Cs>|jrn2||kr ||kr ||_n||kr:|jr:||_d|_dS)NrE)r�r�r�)	r�r=�token�startrPr��INDENT�NAMEZOPENERSrrr�
tokeneaterZszIndentSearcher.tokeneatercCsltj}|jt_zHy(tj|j�}x|D]}|j|�q$WWntjtfk
rRYnXWd|t_X|j|j	fS)N)
�tokenize�tabsizer��generate_tokensr�r��
TokenError�SyntaxErrorr�r�)r�Zsave_tabsize�tokensr�rrrr�fs

zIndentSearcher.runN)r�r�r�r�r�r�)
r7r�r�r�r�r�r�r�r�r�rrrrr�Ds
	r�cCs6|jd�}|dkr.|d|�||dd�}||fS)NrMrrE)r/)r�r}rrrr�xs
r��[�]�/)ZbracketleftZbracketrightZslashcCs�|j|�}|s tj�r$|dkr$dS|d}tjddd�|�}tjd	d
d�|�}tjdd|�}tjdd
|�}tjdd|�}tjdd|�}tjdd|�}tjdd|�}tjdd|�}|S)N�<<open-module>>�
<<goto-line>>�<<change-indentwidth>>r7rz-[a-z]\bcSs|j�j�S)N)�group�upper)r�rrrrD�sz!get_accelerator.<locals>.<lambda>z\b\w+\bcSstj|j�|j��S)N)�keynamesr�r)r�rrrrD�szKey-ZCancelz
Ctrl-BreakzControl-zCtrl-r��+z><r�r�r�>r�rr�)r�r	Z	isCocoaTkr�r�)rYrrZr�rrrr`�s"
r`cCs4|j}|jddd�|jddd�|jddd�dS)	NZtcl_wordBreakAfterza brr�Z
tcl_wordcharsz\wZtcl_nonwordcharsz\W)rr)r]rrrr�
fixwordbreaks�srcCs�|}t|�tjdd�r&tjd}nd}tj|d�t||d�}|j}d|d<x,td�D] }|jdd|t	|�d�qZWdS)	NrE)r]r��
r@�r�z  rN)
rr�argvr	ZsetupApprr>r�r�r�)r r]r�r�r>r}rrr�_editor_window�sr	�__main__)r:zidlelib.idle_test.test_editorr5F)�	verbosity�exit)r�)6Z
importlib.abcr��importlib.utilrSrWr�r�r�r%ZtkinterZtkinter.ttkrZtkinter.simpledialogZsimpledialogr�Ztkinter.messageboxZ
messageboxr�Zidlelib.configrr8rrrrr	Zidlelib.multicallr
rrr
rrr�Zpython_versionr�rrr�objectrr�r�r�r�rr`rr	r7Zunittestr:Zidlelib.idle_test.htestr�rrrr�<module>sn



4
	


Hacked By AnonymousFox1.0, Coded By AnonymousFox