Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/editor.cpython-37.opt-2.pyc

B

YI~dN�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlTddlm
Z
ddlmZddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlm Z dd
lm!Z!ddlm"Z"ddlm#Z#ddl$m%Z%ddlm&Z&dZ'de�(�Z)ejdkZ*dd�Z+Gdd�de,�Z-dd�Z.e�/d�Z0dd�Z1Gdd�de,�Z2d d!�Z3d"d#d$d%�Z4d&d'�Z5d(d)�Z6d*d+�Z7e8d,k�r�dd-l9m:Z:e:d.d/d0d1�dd2l;m<Z<e<e7�dS)3�N)�*)�Font)�	Scrollbar)�idleConf)�configdialog)�grep)�help)�
help_about)�macosx)�MultiCallCreator)�pyparse)�query)�replace)�search)�wheel_event)�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�3/opt/alt/python37/lib64/python3.7/idlelib/editor.py�_sphinx_version%sr c@sFeZdZddlmZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZmZmZmZddl m!Z!ddl"m#Z#ddl$m%Z%e&�'�Z(dZ)dZ*dZ+d�dd�Z,d�dd�Z-dd�Z.dd�Z/dd�Z0dd�Z1d�dd �Z2d!d"d#d$d%d&d'gZ3d(d)�Z4d*d+�Z5d,d-�Z6d.d/�Z7d0d1�Z8dZ9d2d3�Z:d4gZ;d5d6�Z<d7d8�Z=d9d:�Z>d;d<�Z?d�d=d>�Z@d�d?d@�ZAd�dAdB�ZBd�dCdD�ZCdEdF�ZDdGdH�ZEdIdJ�ZFd�dKdL�ZGd�dMdN�ZHdOdP�ZIdQdR�ZJdSdT�ZKdUdV�ZLdWdX�ZMdYdZ�ZNd[d\�ZOd]d^�ZPd_d`�ZQdadb�ZRdcdd�ZSd�dedf�ZTd�dgdh�ZUd�didj�ZVdkdl�ZWdmdn�ZXdodp�ZYdqdr�ZZdsdt�Z[dudv�Z\dwdx�Z]dydz�Z^e_j`e_jad{Zbd|d}�Zcd~d�Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d�d��Zkd�d��Zld�d��Zmd�d��Znd�d��Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsd�d�d��Ztd�d��Zud�d�d��Zvd�d��Zwd�d��Zxd�d��Zyd�d��Zzd�d��Z{d�d��Z|d�d��Z}d�d��Z~d�d��Zd�d�iZ�d�d��Z�d�d�d��Z�d�d�d��Z�d�d��Z�d�d�d„Z�d�d�dĄZ�d�dƄZ�d�dȄZ�d�dʄZ�d�d̄Z�d�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�dބZ�dS)��EditorWindowr)�
Percolator)�ColorDelegator�color_config)�
UndoDelegator)�	IOBinding�encoding)�mainmenu)�MultiStatusBar)�AutoComplete)�
AutoExpand)�Calltip)�CodeContext)�LineNumbers)�FormatParagraph�FormatRegion�Indents�Rstrip)�
ParenMatch)�Squeezer)�
ZoomHeightNTcCsH	ddlm}tjdk�rtj�tjdd�}tj	�
d�rvddtjdd�}tj�d	�r^d
}q�d}tj�||dd�}nVtj	dd�dkr�tj�tjdd
t
��}	tj�|	�r�|	}ntj	dkr�tj�tjd�}tj�|�}tj�|��r|t_tj	dk�rdtjt_ndtjdd�t_||_|�p*|j}||_t|�|_tj||jd�|_}
|�rl|j|_|j|j_ni|_i|j_tj�o�tj�tjd�|_d|_t|
�|_ }t!|dd�|_"}tj#ddddd�}
dddd|
d tj#ddd!dd�d"�}t$t%�|f|�|_&}|j&|j_'|�(�|�)�|j�*d#|j+�|j�,d$|j-�t.�/��rt|�,d$|j-�|�,d%|j0�|�,d&|j0�n|�,d'|j0�|�,d(t1�|�,d)t1�|�,d*t1�|�,d+|j2�|�,d,|j3�|�,d-|j4�|�,d.|j5�|�,d/|j6�|�,d0|j7�|�,d1|j8�|�,d2|j9�|�,d3|j:�|�,d4|j;�|�,d5d6d7��|�,d8|j<�|�,d9|j=�|�,d:|j>�|�,d;|j?�|�,d<|j@�|�,d=|jA�|�,d>|jB�|�,d?|jC�|�,d@|jD�|�,dA|jE�|�,dB|jF�|�G|�|_H}|�,dC|jI�|�,dD|jJ�|�,dE|jK�|�,dF|jL�|�,dG|jM�|�,dH|jN�|�O|�}|�,dI|jP�|�,dJ|jQ�|�,dK|�Rd��|�,dL|�RdM��|�,dN|jS�|�,dO|jT�|�,dP|jU�|�r||j|<|�r�||jV|<|�,dQ|jW�|�,dR|jjX�|�,dS|jY�|�,dT|jZ�|�,dU|j[�|�\�|j]t^t_dMdV�|j`dMdMdW�|jadMdMdW�|jb|dX<|jcdMdtddY�|je|dZ<t�f|jdd�|d[<|jcdMdMtddY�|�g�|�h�tj#dd\d]d^d�}||_id_|_j|jj|_k|�l�tmtd`��s�|j&dat_n|�o�db|_p|�q|�|_r}|�s�|_t}|�u|�|jv|_v|jw|_w|�x|jy�|�z|�|_{}|�||j}�dc|_~|�dc�d|_�d|_�d|_�|�r�tj��|��r�tj�|��s�|��|��r�dd|_~|��|�}|�|�n|��|�dd|_~|���|�y�|���|���|j���de�}|�rP|��df�}|dk�r$dg}|dk�r>|���|dM}||_�t��|j��t�j�|_�t�j�|_�t�j�|_�|��dhdi�|��djdkdldm�|��dndo�|��dpdq�|��drdqdsdt�|��|�}|�,dh|j��|�,dj|j��|�,du|j��|�,dv|��|�j��|�,dw|��|�j��|��|�}|�,dx|j��|�,dr|j��||�}|�,dy|j��|�,dz|j��|�,d{|j��|�,d||��|�j��|��|�|_�}|�,dn|j��|�,dp|j��|�,d}|j��|�,d~|��|�j��|j��r�|��|�|_�|�,d|j�j��n|��d�d�d��|j��	r6|��|�|_�tj#ddd�d^d��	r&|���|�,d�|j��n|��d�d�d��dS)�Nr)�
ScriptBindingZDocz
index.htmlZlinuxz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)r=�padx�wrapZhighlightthicknessr?ZtabstylerDZWM_DELETE_WINDOWz<<close-window>>z<Control-Button-1>z<2>z<3>z<MouseWheel>z
<Button-4>z
<Button-5>z<Configure>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>��z'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>>)�side�fill�expand)Zweight�command)�row�columnZstickyZyscrollcommand�font�Indentz
use-spaces�boolr�blink_off_time�
insertofftime)�2i�i@KLFTr�end���z<<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<<run-custom>>z
<<do-rstrip>>z<<force-open-calltip>>z<<zoom-height>>z<<toggle-code-context>>�optionsz
*Code Context�disabledzline-numbers-defaultz<<toggle-line-numbers>>z
*Line Numbers)�Zidlelib.runscriptr6r!�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_framerr<�	GetOptionrZTextrBZfocused_widget�
createmenubar�apply_bindingsZprotocol�close�bind�close_eventr
ZisAquaTk�right_menu_eventr�handle_winconfig�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_eventr0�fregion�indent_region_eventZdedent_region_eventZcomment_region_eventZuncomment_region_eventZtabify_region_eventZuntabify_region_eventr1Ztoggle_tabs_eventZchange_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�packZLEFTZBOTHZrowconfigureZcolumnconfigure�handle_yviewZgridZNSEW�set�GetFontZ	focus_set�	set_width�usetabs�tabwidth�indentwidth�set_notabs_indentwidth�hasattrrU�update_cursor_blink�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�code_context�line_numbers�exists�loadfile�ispythonsourceZset_filename�ResetColorizer�update_recent_files_list�load_extensions�menudict�get�index�
add_separator�	wmenu_endZregister_callback�postwindowsmenu�tkMessageBoxZaskyesno�tkSimpleDialogZ
askinteger�	showerror�	event_addr*Zautocomplete_eventZtry_open_completions_eventZforce_open_completions_eventr+Zexpand_word_eventr/Zformat_paragraph_eventr3Zflash_paren_eventZparen_closed_eventZcheck_module_eventZrun_module_eventZrun_custom_eventr2Z	do_rstripr,�ctipZtry_open_calltip_eventZrefresh_calltip_eventZforce_open_calltip_eventr5Zzoom_height_event�allow_code_contextr-Ztoggle_code_context_event�update_menu_state�allow_line_numbersr.�toggle_line_numbers_event)�selfrf�filename�keyrgr6ZdochomeZpyverZbasepathZchmfilerjrqr<r?Ztext_optionsrBr��indentsZ	usespacesr�r�r��	is_py_srcr:rXZautocompleteZ
parenmatchZ
scriptbindingr�rrr�__init__Hs�





















zEditorWindow.__init__cCs|��dS)N)r�)r�rHrrrry`szEditorWindow.handle_winconfigcCs^|j}tt|jj|�d�|�d�g��}|��d|}t||�d�d��d�}|||_	dS)NZborderrEr9rR)rR�0)
rB�sum�map�tkZgetintZcgetZwinfo_widthr�measurer?)r�rBZ
inner_paddingZpixel_widthZzero_char_widthrrrr�cszEditorWindow.set_widthcCs|j��\}}|j�|�dS)NrG)r�Zdefaultfilenamerf�new)r�rH�dirname�basenamerrrr�pszEditorWindow.new_callbackcCs�|jd@dkr|jdkrdS|j�d�rd|j�ddd�rd|j�ddd�rdt|j�d��d�d	�}n:|j�dd�}x*tt	|��D]}||d
kr�Pq�Wt	|�}t|j�d��d�d	�}||kr�d}dt
|�d
}|jd	@dkr�|j�ddd�n�|j�d��s|j�dd�n@|j�|j�d�d|j�d���rD|j�dd�n|j�dd�|j�|�}|j�d�}|j�|d|��r�||}}|j�ddd�|j�
d||�|j�d|�|j�d�dS)N�rZHomeZiomarkz<=zinsert lineendzinsert linestart�.rK)� �	�insertzinsert linestart+�c�selz1.0rXz	sel.firstZ	my_anchor�<zsel.last�>rG)�stateZkeysymrBr��comparer@�splitr��range�len�str�
tag_remove�mark_set�tag_add�see)r�rHZinsertpt�lineZlineat�dest�first�lastrrrr�us@
zEditorWindow.home_callbackcCs�|�|j�|_t|jdddd�}tjdkr<|jjddtd�|jjdd	td�|jjd
dtd�|jjt	t
d�|jt	t
d�|j�d
|j
�|j�d
dd�|j�|j
�dS)NrKZgrey75)rDZborderwidthZ
backgroundrZ	_padding1z    )rLrQzCol: ?r�zLn: ?)rLrMz<<set-line-and-column>>z<KeyRelease>z<ButtonRelease>)r)rj�
status_barrprra�	set_labelZRIGHTr�ZBOTTOM�XrBrv�set_line_and_columnr�Z
after_idle)r��seprrrr��s
zEditorWindow.set_status_barcCs>|j�t��d�\}}|j�dd|�|j�dd|�dS)Nr�rQzCol: %sr�zLn: %s)rBr�ZINSERTr�r�r�)r�rHr�rQrrrr��sz EditorWindow.set_line_and_column)�fileZ_File)�editZ_Edit)�formatZF_ormat)�runZ_Run)rZZ_Options)rZ_Window)rZ_HelpcCs�|j}i|_}xD|jD]:\}}t|�\}}t||dd�||<}|j|||d�qWt��r�t|ddd�|d<}|jd|d�|��t|jdd�|_	|jd	j
d
dd|j	d�|jd
�t�|_
|��dS)Nr)r=�tearoff)�labelr:�	underlineZappleZapplicationZIDLE)r�r:)r�r�r7zRecent Files)r�r�r:r)rir��
menu_specs�prepstrrhZadd_cascader
Z
isCarbonTk�
fill_menus�recent_files_menuZinsert_cascader��END�base_helpmenu_length�reset_help_menu_entries)r�Zmbarr�r=r�r�r:rrrrs�s"

zEditorWindow.createmenubarcCsJ|jd}|�d�}|dkr d}||jkr<|�|jd|�t�|�dS)NrrXrYrK)r�r�r��deleterZadd_windows_to_menu)r�r:rXrrrr��s


zEditorWindow.postwindowsmenucCs|j|}|j||d�dS)N)r�)r��entryconfig)r�r:r�r��menuitemrrr�update_menu_label�s
zEditorWindow.update_menu_labelcCs|j|}|j||d�dS)N)r�)r�r)r�r:r�r�rrrrr��s
zEditorWindow.update_menu_statecGsR|dkr<t|d�}t|�d�|�|�d�}d}|df}|jj|f|��dS)NZmovetorrXz@0,0ZscrollZunitsrG)�float�round�	getlinenorB�yview)r�rH�argsZfraction�linesrrrr��szEditorWindow.handle_yviewc	Cs6|j}|�d|j�d|j���}y |�dd|�o<|�|dd�}Wntk
rXd}YnX|sx|�ddd	�|�d
|�|js�|�	�|j}||_
tjdd�dk}|r�|j
d
d�xX|jD]N}y|\}}	}
Wntk
r�w�YnX|
dkr�q�t||
��}|j||d�q�W|�|j|j�|�r2|jj
dd�dS)N�@�,z	sel.firstz<=zsel.lastFr�z1.0rXr�r7r8Zarrow)Zcursor)r�ZibeamrG)rBr��x�yr��TclErrorr�r��rmenu�
make_rmenurHrraZconfig�rmenu_specs�
ValueError�getattrZentryconfigureZtk_popupZx_rootZy_root)r�rHrBZnewdexZin_selectionrZiswin�itemr��	eventnameZverify_stater�rrrrx�s<
zEditorWindow.right_menu_event)ZClosez<<close-window>>NcCsjt|jdd�}xP|jD]F}|d|d}}|dk	rT|j|fdd�}|j||d�q|��qW||_dS)Nr)r�rKcSs|�|�dS)N)�event_generate)rBrrrrrO"sz(EditorWindow.make_rmenu.<locals>.command)r�rO)rhrBr�add_commandr�r)r�rrr�rrOrrrrszEditorWindow.make_rmenucCs|��S)N)�rmenu_check_copy)r�rrr�rmenu_check_cut)szEditorWindow.rmenu_check_cutcCs6y|j�d�}Wntk
r$dSX|r.dSdSdS)Nz	sel.firstr[�normal)rBr�r
)r�Zindxrrrr,s
zEditorWindow.rmenu_check_copycCs6y|jj�d|jd�Wntk
r,dSXdSdS)Nztk::GetSelectionZ	CLIPBOARDr[r)rBr��callr
)r�rrr�rmenu_check_paste4s
zEditorWindow.rmenu_check_pastecCst�|j�dS)NrG)r	ZAboutDialogrj)r�rHrrrr�<szEditorWindow.about_dialogcCst�|jd�dS)NZSettingsrG)rZConfigDialogrj)r�rHrrrr�BszEditorWindow.config_dialogcCs"|jr|j}n|j}t�|�dS)NrG)rgrjrZ
show_idlehelp)r�rH�parentrrrr~Hs

zEditorWindow.help_dialogc
Csntjdd�dkr^yt�|j�Wqjtk
rZ}ztjdt|�|j	d�Wdd}~XYqjXnt
�|j�dS)Nr7r8zDocument Start Failure)�title�messagerrG)rrar]�	startfiler\�OSErrorr�r�r�rB�
webbrowser�open)r�rH�whyrrrrRs$zEditorWindow.python_docscCs|j�d�dS)Nz<<Cut>>rG)rBr)r�rHrrrrz]szEditorWindow.cutcCs |j�d�sdS|j�d�dS)Nr�z<<Copy>>rG)rBZ
tag_rangesr)r�rHrrrr{aszEditorWindow.copycCs|j�d�|j�d�dS)Nz	<<Paste>>r�rG)rBrr�)r�rHrrrr|hszEditorWindow.pastecCs.|j�ddd�|j�dd�|j�d�dS)Nr�z1.0zend-1cr�rG)rBr�r�r�)r�rHrrrr�mszEditorWindow.select_allcCs |j�ddd�|j�d�dS)Nr�z1.0rXr�rG)rBr�r�)r�rHrrrr�sszEditorWindow.remove_selectioncs*|jj�|jj�d�����fdd�}|S)N)zsel.first+1czsel.last-1ccsB|jd@dkr>y�d��d���Wntk
r<YnXdS)NrCrz	sel.firstr�)r�r
)rH)�
edge_index�edges_table�self_text_index�self_text_mark_setrr�move_at_edge�sz<EditorWindow.move_at_edge_if_selection.<locals>.move_at_edge)rBr�r�)r�r$r(r)r$r%r&r'rr�xs
z&EditorWindow.move_at_edge_if_selectioncCs|j�d�dS)Nz
<Meta-Delete>rG)rBr)r�rHrrrr��szEditorWindow.del_word_leftcCs|j�d�dS)Nz<Meta-d>rG)rBr)r�rHrrrr��szEditorWindow.del_word_rightcCst�|j�dS)NrG)r�findrB)r�rHrrrr��szEditorWindow.find_eventcCst�|j�dS)NrG)rZ
find_againrB)r�rHrrrr��szEditorWindow.find_again_eventcCst�|j�dS)NrG)rZfind_selectionrB)r�rHrrrr��sz!EditorWindow.find_selection_eventcCst�|j|j|j�dS)NrG)rrBr�rf)r�rHrrrr��sz EditorWindow.find_in_files_eventcCst�|j�dS)NrG)rrB)r�rHrrrr��szEditorWindow.replace_eventcCsT|j}t�|dd�j}|dk	rP|�ddd�|�d|�d��|�d�|��dS)	Nz
Go To Linez/Enter a positive integer
('big' = end of file):r�z1.0rXr�z.0rG)rBr
ZGoto�resultr�r�r�r�)r�rHrB�linenorrrr��s
zEditorWindow.goto_line_eventcCspy|j�dd���}Wntk
r.d}YnXt�|jdd|�j}|dk	rl|jr`|j�|�n|j	�
|�|S)Nz	sel.firstzsel.lastr;zOpen ModulezAEnter the name of a Python module
to search on sys.path and open:)rBr��stripr
r
Z
ModuleNamer*rfr"r�r�)r�r=�	file_pathrrr�open_module�s
zEditorWindow.open_modulecCs|��dS)NrG)r.)r�rHrrrr��szEditorWindow.open_module_eventcCsJ|jj}|jjdkr|s,|��}|dkr,dSddlm}|�|j|�dS)NZPyShellEditorWindowrGr)�browser)	r�r��	__class__�__name__r.�idlelibr/Z
ModuleBrowserrg)r�rHr�r/rrrr��sz EditorWindow.open_module_browsercCsddlm}|�|j�dS)Nr)�pathbrowserrG)r2r3ZPathBrowserrg)r�rHr3rrrr��szEditorWindow.open_path_browsercCs&ddl}tjddg}|j|dd�dS)Nrz-cz,from turtledemo.__main__ import main; main()F)�shellrG)�
subprocessr�
executable�Popen)r�rHr5�cmdrrrr��szEditorWindow.open_turtle_democCsN|dk	rJ|dkrJ|j�dd|�|j�ddd�|j�ddd�|��dS)Nrr�z%d.0r�z1.0rXz
insert +1l)rBr�r�r��center)r�r+rrr�gotoline�s
zEditorWindow.gotolinecCs`|rtj�|�rdStj�tj�|��\}}tj�|�dkr@dS|j�dd�}|�d�o^d|kS)NT)z.pyz.pywz1.0z1.0 lineendz#!�python)	r]r^rc�splitextr��normcaserBr��
startswith)r�r��baseZextr�rrrr��szEditorWindow.ispythonsourcecCs|jr|j�|�d|_dS)N)rfZunregister_maybe_terminate)r�rrr�
close_hook�szEditorWindow.close_hookcCs
||_dS)N)r@)r�r@rrr�set_close_hookszEditorWindow.set_close_hookcCs2|jr|j�|�|��|j�|�|��dS)N)rfZfilename_changed_editr�rjZupdate_windowlist_registryr�)r�rrrr�s
z!EditorWindow.filename_change_hookcCsV|jr
dS|�|jj�r"|��|_|jrR|j�|j�|j�|j�|j�|j�dS)N)	r�r�r�r�r#r��removefilterr�r�)r�rrr�
_addcolorizer
s
zEditorWindow._addcolorizercCs,|js
dS|j��|j�|j�d|_dS)N)r�Zremovecolorsr�rB)r�rrr�_rmcolorizers

zEditorWindow._rmcolorizercCsH|��|��t�|j�|jdk	r0|j��|jdk	rD|j��dS)N)	rDrCr!r$rBr�Zupdate_highlight_colorsr�Z
update_colors)r�rrrr�s


zEditorWindow.ResetColorizer�_cCsp|�d|�|�|�}|r6||jkr6|�d|d|�d|�|�krR|�d|�n|�d|d�|�|�dS)NZERRORz
 wordstart�
r�z+1c)r�r��
IDENTCHARSr�r�)r�rB�pos�charrrr�colorize_syntax_error+s
z"EditorWindow.colorize_syntax_errorcCs2tjddddd�}|s"d|jd<ntj|jd<dS)Nr>r!zcursor-blinkrT)rArrV)rrrrBrU)r�Zcursorblinkrrrr�6s
z EditorWindow.update_cursor_blinkcCsN|jdk	r|j��|jdk	r(|j��t�|jdd�}||jd<|��dS)Nr>r!rR)r�Zupdate_fontr�rr�rgrBr�)r�Znew_fontrrr�	ResetFont@s




zEditorWindow.ResetFontcCs�t��|j_}x&|��D]\}}|jj|f|��qWxF|��D]:}t�|�}|rBx&|��D]\}}|jj|f|��q^WqBWdS)N)	r�GetCurrentKeySetr(�default_keydefs�itemsrBZevent_delete�get_standard_extension_names�GetExtensionBindings)r��keydefsrH�keylist�
extensionName�xkeydefsrrr�RemoveKeybindingsQs
zEditorWindow.RemoveKeybindingsc
CsVt��|j_}|��x(|��D]}t�|�}|r"|�|�q"Wi}xR|jjD]F}i||d<x4|dD](}|rj|d||dt|d�d<qjWqPWx�|j	D]�}|j	|}|�
t�}|dkr�q�|d7}x�td|�D]r}	|�
|	�dkr�|�|	d�}
|
r�|�|	d�}d}||k�r.|||k�r.|||}|r�t||�}
|j|	|
d�q�Wq�WdS)NrrKrO�acceleratorr�r;)rV)rrLr(rMrtrOrP�menudefsr�r�r�r�r�rAZ	entrycget�get_acceleratorr)
r�rQrSrTZ
menuEventDictr:rZmenubarItemrXr�ZaccelZitemNamerHrrr�ApplyKeybindings]s<
(



zEditorWindow.ApplyKeybindingscCs|jstjddddd�|_dS)Nr>rSz
num-spacesr@)rA)r�rrrr�)r�rrrr��s
z#EditorWindow.set_notabs_indentwidthcCs�t��}|jd}|�t�}||jkr8|�|jd|�|rr|��x,|D]$}|�|d�}|j	|d|d�qJW||jd<dS)NrrKr)r�rO)
rZGetAllExtraHelpSourcesListr�r�r�r�r�r��"_EditorWindow__extra_help_callbackr)r�Z	help_listZhelpmenuZhelpmenu_length�entryr8rrrr��s



z$EditorWindow.reset_help_menu_entriescs|f�fdd�	}|S)Nc
s�|�d�stj�|�}tjdd�dkrryt�|�Wq|tk
rn}ztj	dt
|��jd�Wdd}~XYq|Xn
t�
|�dS)N)ZwwwZhttpr7r8zDocument Start Failure)rrr)r>r]r^rerrarr r�r�r�rBr!r")�helpfiler#)r�rr�display_extra_help�s
$z>EditorWindow.__extra_help_callback.<locals>.display_extra_helpr)r�r\r]r)r�rZ__extra_help_callback�sz"EditorWindow.__extra_help_callbackc
s�g}|j}|r>tj�|�r>t|dddd��}|��}WdQRX|rptj�|�d}||krd|�|�|�d|�g�x2|D]*}d|ks�tj�|dd��sz��	|�qzW�fd	d
�|D�}d}|dt
|��}|�rVy*t|dddd��}|�|�WdQRXWnVtk
�rT}z6t
|jd
d��sDd|j_tjdd|�d�|jd�Wdd}~XYnXxj|jjD]^}	|	j}
|
�dt�xDt|�D]8\}}|��}|	�|�}
|
j||d||
dd��q�W�q`WdS)N�r�utf_8r)r'�errorsrFr�rYcsg|]}|�kr|�qSrr)�.0r^)�	bad_pathsrr�
<listcomp>�sz9EditorWindow.update_recent_files_list.<locals>.<listcomp>Z1234567890ABCDEFGHIJK�w�recentfiles_messageFTzIDLE Warningz)Cannot save Recent Files list to disk.
  z
Select OK to continue.)rrrr�)r�rOr�)rnr]r^r�r"�	readlines�abspath�remover��appendr��
writelinesr rrgrfr��showwarningrBrjrmr�r�r��	enumerate�rstrip�#_EditorWindow__recent_file_callbackr)r��new_fileZrf_listr-Zrf_list_filer^ZulcharsZrf_file�err�instancer:�i�	file_name�callbackr)rcrr��sL



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�rtrvr)r�rZ__recent_file_callback�sz#EditorWindow.__recent_file_callbackcCs�|��}|��}|r*|r*|d|t}n|r4|}n|r>|}nd}|pL|pL|}|��sfd|}d|}|j�|�|j�|�dS)Nz - �untitledz*%s*z*%s)�short_title�
long_title�_py_version�	get_savedrjZwm_titleZwm_iconname)r�ZshortZlongrZiconrrrr��szEditorWindow.saved_change_hookcCs
|j��S)N)r�r{)r�rrrr{�szEditorWindow.get_savedcCs|j�|�dS)N)r��	set_saved)r��flagrrrr|�szEditorWindow.set_savedcCs|j��dS)N)r��
reset_undo)r�rrrr~�szEditorWindow.reset_undocCs|jj}|rtj�|�SdS)Nrw)r�r�r]r^r�)r�r�rrrrx�szEditorWindow.short_titlecCs|jjp
dS)Nr;)r�r�)r�rrrry�szEditorWindow.long_titlecCs|��dS)NrG)r9)r�rHrrrr}�sz EditorWindow.center_insert_eventr�cCsH|j}|��\}}|�|�}||}td||d�}|�t|��dS)NrKr9)rB�getwindowlinesr�maxrr)r��markrBrj�botr+rDZnewtoprrrr9s
zEditorWindow.centercCsN|j}|�d�}|�d�}||krF|��dkrFt|d�}||d}||fS)Nz@0,0z@0,65535rKrD)rBrZwinfo_heightr@)r�rBrjr�rDrrrr	s

zEditorWindow.getwindowlinescCs|j}tt|�|���S)N)rBr@rr�)r�r�rBrrrrszEditorWindow.getlinenocCs(|j��}t�d|�}ttt|����S)Nz(\d+)x(\d+)\+(-?\d+)\+(-?\d+))rjZwm_geometry�re�match�listr�r@�groups)r�Zgeom�mrrr�get_geometrys
zEditorWindow.get_geometrycCs|��dS)NrG)ru)r�rHrrrrwszEditorWindow.close_eventcCsH|jrD|��s:|j��dkr&|j��|j��|j��|j��SdS)Nr)r�r{rjr�Z	deiconify�lowerZlift�	maybesave)r�rrrr�!s


zEditorWindow.maybesavecCs:y |��}t|�dkr|��|Stk
r4YnXdS)NZcancel)r�r��_close�AttributeError)r�Zreplyrrrru*szEditorWindow.closecCs�|jjr|j|jjd�t�|j�|��|j��d|_d|_|j	rX|j	��d|_	d|_
d|_|j��d|_|j
��|jr�|��dS)N)rp)r�r�r�rZunregister_callbackr��unload_extensionsrur�r�rBrlr�rjZdestroyr@)r�rrrr�3s"



zEditorWindow._closecCsi|_|��dS)N)�
extensions�load_standard_extensions)r�rrrr�GszEditorWindow.load_extensionscCs4x(t|j���D]}t|d�r|��qWi|_dS)Nru)r�r��valuesr�ru)r��insrrrr�Ks
zEditorWindow.unload_extensionscCsHxB|��D]6}y|�|�Wq
tdt|��t��Yq
Xq
WdS)NzFailed to load extension)rO�load_extension�print�repr�	traceback�	print_exc)r�r=rrrr�Qsz%EditorWindow.load_standard_extensionscCstjdd�S)NT)Zeditor_only)rZ
GetExtensions)r�rrrrOYsz)EditorWindow.get_standard_extension_namesZZzDummyZzzdummyc		CsF|j�||�}y>ytjd|td�}Wn"ttfk
rHt�|�}YnXWn tk
rltd|��YnXt||�}t	�
|�}t|d�r�|�|j
|�||�}||j|<|�rB|�|�x�|D]|}|�dd�}x |dd�dkr�|dd�}q�Wx"|d	d�d
k�r|dd	�}q�W|d}t||�r�|j�|t||��q�WdS)Nr�)�packagez
Failed to import extension: rW�-rErKr�rYr�Z_event)�extfilesr��	importlib�
import_module�__package__�ImportError�	TypeErrorr�rrrPr�r�rWr�rtrrBrv)	r�r=Zfname�mod�clsrQr�ZveventZ
methodnamerrrr�`s4







zEditorWindow.load_extensioncCsJ|dkr|jj}|j}||_x(|��D]\}}|r&|j|f|��q&WdS)N)r(rMrBrQrNr�)r�rQrBrHrRrrrrt|szEditorWindow.apply_bindingsc	Cs�|dkr|jj}|dkr |jj}|j}|j}x�|D]�\}}|�|�}|sJq2x�|D]�}|sb|��qP|\}	}
|	dd�dk}|r�|	dd�}	t|	�\}}	t||
�}
||
fdd�}|r�|�	|
t
�}|j|	|||
|d�qP|j|	|||
d�qPWq2WdS)NrK�!cSs|�|�dS)N)r)rBrrrrrO�sz(EditorWindow.fill_menus.<locals>.command)r�r�rOrV�variable)r�r�rOrV)
r(rWrMr�rBr�r�r�rX�get_var_objZ
BooleanVarZadd_checkbuttonr)r�rWrQr�rBZmnameZ	entrylistr:r[r�rZcheckbuttonr�rVrO�varrrrr��s8




zEditorWindow.fill_menuscCs&|�|�}|r|��}|St|��dS)N)r�r��	NameError)r�r=r��valuerrr�getvar�s

zEditorWindow.getvarcCs(|�||�}|r|�|�nt|��dS)N)r�r�r�)r�r=r��vartyper�rrr�setvar�szEditorWindow.setvarcCs,|j�|�}|s(|r(||j�|j|<}|S)N)rlr�rB)r�r=r�r�rrrr��szEditorWindow.get_var_objcCs,|jr$|j�d|�p"d|j�|�kSdSdS)NZTODO�STRINGrK)r�rB�
tag_prevrangeZ	tag_names)r�Z
text_indexrrr�is_char_in_string�szEditorWindow.is_char_in_stringcCs:y |j�d�}|j�d�}||fStk
r4dSXdS)Nz	sel.firstzsel.last)NN)rBr�r
)r�r�r�rrr�get_selection_indices�sz"EditorWindow.get_selection_indicescCs|jdpt}t|�S)N�tabs)rB�TK_TABWIDTH_DEFAULTr@)r�Zcurrentrrr�get_tk_tabwidth�szEditorWindow.get_tk_tabwidthc	CsB|j}|��|kr>|j�dd|dd|jd|�}|j|d�dS)NrRr�z
-displayof�n)r�)rBr�r�rZmasterZ	configure)r�ZnewtabwidthrBZpixelsrrr�set_tk_tabwidth�s
zEditorWindow.set_tk_tabwidthcCsP|r@|r@|��}d|kr$dkr.nn||_|j|jkr@d|_|�|j�dS)Nr9rF)�guess_indentr�r�r�r�)r�r�Zguessrsrrrr��sz#EditorWindow.set_indentation_paramsc
CsB|j}|��\}}|r6|r6|�||�|�d|�dS|�dd�}|dkrp|�ddd�rd|�d�n|��dS|dd	kr�|�d�dS|j}t|�	|��}|d
|j
|j
}d}	xH||jkr�P|dd�}|	d
}	t|�	|��}||ks�|dd	kr�Pq�W|��|�d|	d�||k�r6|�
dd
||�|��dS)Nr�rGzinsert linestartr;r�z1.0z	insert-1crYz 	rKrz
insert-%dcr�)rBr�r�r�r�r�Zbellr�r��
expandtabsr�ror�r�r�)
r�rHrBr�r��charsr�ZhaveZwantZ
ncharsdeletedrrrr��sB


z"EditorWindow.smart_backspace_eventc
Cs�|j}|��\}}|��z�|rX|rXt|�t|�kr@|j�|�S|�||�|�d|�|�dd�}t	||j
�\}}|t|�kr�|�||j
�n>|jr�d}n&t|�|j
��}|j
}	d|	||	}|�d|�|�d�dS|��XdS)Nr�zinsert linestartr�r�rG)rBr�r��
index2liner�r�r�r�r��get_line_indentr�r��reindent_tor�r�r�r�r�r�)
r�rHrBr�r��prefix�rawZ	effectiveZpadr�rrrr�&s,
zEditorWindow.smart_indent_eventc	Cs�|j}|��\}}|���z�|r>|r>|�||�|�d|�|�dd�}dt|�}}x ||krx||dkrx|d7}qZW||kr�|�dd�dS|d|�}d}x2|r�|ddkr�||jkr�|dd�}|d7}q�W|r�|�d	|d�x|�d�dk�r|�d�q�W|�dd�t	|�
d��}	t�|j
|j�}
|j�s�xf|jD]\}t|	|d�}t|�d
}
|�|
d�}|
�|�|
�|�|
��}|dk	�s�|dk�rDP�qDW|
�|�p�d�n@|�dd�}|�r�|d}
nd}
|�|
d�}|
�|�|
�d�|
��}|tjk�r�|tjk�rnn|tjk�r2|�d|�nT|tjk�rN|�|
���n8|tjk�r�|
��dk�rv|�d|�n|�|
� ��ndS|
�!�}|�d|�|
�"��r�|�#|�n|�r�|
�$��r�|�%|�dS|�&d�|�'�XdS)
Nr�zinsert linestartrz 	rKrFrGrYzinsert - %d charsz.0Zconsolez1.0)(rBr�r�r�r�r�r�r�ror�r�rZParserr�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�rHrBr�r�r�rsr��indentZlnor�contextZstartatZstartatindexZrawtextZbodr^r�rrrr�Is�	






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_funccCs2|jr&t||j�\}}d|d|Sd|SdS)Nr�r�)r��divmodr�)r�r�ZntabsZnspacesrrr�_make_blanks�szEditorWindow._make_blankscCsJ|j}|��|�ddd�r(|�dd�|r>|�d|�|��|��dS)Nzinsert linestartz!=r�)rBr�r�r�r�r�r�)r�rQrBrrrr��szEditorWindow.reindent_tocCsPt|j|j���\}}|r@|r@t||j�\}}t||j�\}}nd}}||S)Nr)�IndentSearcherrBr�r�r�)r��openerZindentedr�ZindentsmallZindentlargerrrr��szEditorWindow.guess_indentcCsN|jdkrdS|jjr&|j��d}n|j��d}|jdd|�d�d�dS)NZShowZHiderZz
*Line Numbersz
 Line Numbers)r:r�r�)r�Zis_shownZhide_sidebarZshow_sidebarr)r�rHZ
menu_labelrrrr��s


z&EditorWindow.toggle_line_numbers_event)NNNN)N)N)N)N)N)N)N)N)N)N)N)N)r�)r�)N)NN)N)N)T)N)�r1�
__module__�__qualname__Zidlelib.percolatorr"Zidlelib.colorizerr#r$Zidlelib.undor%Zidlelib.iomenur&r'r2r(Zidlelib.statusbarr)Zidlelib.autocompleter*Zidlelib.autoexpandr+Zidlelib.calltipr,Zidlelib.codecontextr-Zidlelib.sidebarr.Zidlelib.formatr/r0r1r2Zidlelib.parenmatchr3Zidlelib.squeezerr4Zidlelib.zoomheightr5r�getfilesystemencodingZfilesystemencodingr\r�r�r�ryr�r�r�r�r�r�rsr�rr�r�rrxrrrrrr�r�r~rrzr{r|r�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r:r�r@rAr�rCrDr��stringZ
ascii_letters�digitsrGrJr�rKrUrYr�r�rZr�ror�r{r|r~rxryr}r9rrr�rwr�rur�r�r�r�rOr�r�rtr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr!1s


+

%









		

$
.


		
	
%


	,#v
	r!cCstt|��S)N)r@r)r�rrrr��sr�z[ \t]*cCs$t�|�}|��t|���|��fS)N)�_line_indent_rer�rXr��groupr�)r�r�r�rrrr�s
r�c@s8eZdZdd�Zdd�Zejejdfdd�Zdd	�Z	d
S)r�cCs(||_||_d|_|_d|_|_dS)Nr)rBr�rs�finished�blkopenline�indentedline)r�rBr�rrrr�szIndentSearcher.__init__cCsL|jr
dS|jd}|_t|�d}|j�|dd�r:dS|j�||d�S)Nr;rKz.0z>=rXz lineend+1c)r�rsr�rBr�r�)r�rsr�rrr�readlineszIndentSearcher.readline)�class�def�for�if�try�whilec		Cs>|jrn2||kr ||kr ||_n||kr:|jr:||_d|_dS)NrK)r�r�r�)	r�rA�token�startrXr��INDENT�NAMEZOPENERSrrr�
tokeneater#szIndentSearcher.tokeneaterc	Csltj}|jt_zHy(t�|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�/s

zIndentSearcher.runN)
r1r�r�r�r�r�r�r�r�r�rrrrr�
s
	r�cCs6|�d�}|dkr.|d|�||dd�}||fS)NrErrK)r))�srsrrrr�As
r��[�]�/)ZbracketleftZbracketrightZslashcCs�|�|�}|rt��r"|dkr"dS|d}t�ddd�|�}t�ddd�|�}t�d	d|�}t�d
d|�}t�dd
|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}|S)N>�<<open-module>>�<<change-indentwidth>>�
<<goto-line>>r;rz-[a-z]\bcSs|����S)N)r��upper)r�rrrrIZrJz!get_accelerator.<locals>.<lambda>z\b\w+\bcSst�|��|���S)N)�keynamesr�r�)r�rrrrI[rJzKey-ZCancelz
Ctrl-BreakzControl-zCtrl-r��+z><r�r�r�)r�r
Z	isCocoaTkr��sub)rQrrRr�rrrrXPs
rXcCs4|j}|�ddd�|�ddd�|�ddd�dS)	NZtcl_wordBreakAfterza brr�Z
tcl_wordcharsz\wZtcl_nonwordcharsz\W)r�r)rgr�rrr�
fixwordbreaksfsr�cCs�|}t|�tjdd�r&tjd}nd}t�|d�t||d�}|j}d|d<x,td�D] }|�dd|t	|�d�qZWdS)	NrK)rgr��
rD�r�z  rF)
r�r�argvr
ZsetupAppr!rBr�r�r�)rrgr�r�rBrsrrr�_editor_windowosr��__main__)r>zidlelib.idle_test.test_editorr9F)�	verbosity�exit)r�)=Z
importlib.abcr��importlib.utilr]rar�r�rr�r�r!ZtkinterZtkinter.fontrZtkinter.ttkrZtkinter.simpledialogZsimpledialogr�Ztkinter.messageboxZ
messageboxr�Zidlelib.configrr2rrrr	r
Zidlelib.multicallrrr
rrZidlelib.treerrr�Zpython_versionrzrr �objectr!r��compiler�r�r�r�r�rXr�r�r1Zunittestr>Zidlelib.idle_test.htestr�rrrr�<module>sv
X

4
	


Hacked By AnonymousFox1.0, Coded By AnonymousFox