Your IP : 18.119.253.198


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/AutoCompleteWindow.cpython-35.opt-2.pyc



���]KE�
@s}ddlTddlmZddlmZmZdZdZdZdZ	dZ
dZdZdZ
dZGdd�d�ZdS)�)�*)�MC_SHIFT)�COMPLETE_FILES�COMPLETE_ATTRIBUTESz<<autocompletewindow-hide>>�
<FocusOut>�
<ButtonPress>z<<autocompletewindow-keypress>>�<Key>�<Key-BackSpace>�<Key-Return>�	<Key-Tab>�<Key-Up>�
<Key-Down>�
<Key-Home>�	<Key-End>�<Key-Prior>�
<Key-Next>z!<<autocompletewindow-keyrelease>>z<KeyRelease>z<B1-ButtonRelease>z<Configure>z<B1-Double-ButtonRelease>c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �AutoCompleteWindowcCs�||_d|_|_|_d|_|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|_|_|_|_|_d|_dS)NF)�widget�autocompletewindow�listbox�	scrollbar�origselforeground�origselbackground�completions�morecompletions�mode�start�
startindex�lasttypedstart�userwantswindow�hideid�
keypressid�listupdateid�winconfigid�keyreleaseid�
doubleclickid�lastkey_was_tab)�selfr�r(�7/opt/alt/python35/lib64/python3.5/AutoCompleteWindow.py�__init__s								,zAutoCompleteWindow.__init__cCs�tt|j�t|��}d}x1||krW|j|||krW|d7}q'W|t|j�kr�|jjd|j|fd|jt|j�f�|t|�kr�|jjd|j|f||d��||_dS)Nr�z%s+%dc)�min�lenrr�deleter�insert)r'�newstart�min_len�ir(r(r)�
_change_start8s&z AutoCompleteWindow._change_startcCsvd}t|j�}xD||kr[||d}|j||krN|}q|d}qWt|t|j�d�S)Nr�r+)r-rr,)r'�sr2�j�mr(r(r)�_binary_searchEs	z!AutoCompleteWindow._binary_searchc
CsG|j|�}|j|dt|��|kr6|S|d}t|j�}xT||kr�||d}|j|dt|��|kr�|}qR|d}qRW|d}||kr�|j|S|j|}|j|}tt|�t|��}	t|�}x.||	kr8||||kr8|d7}qW|d|�S)Nr+r4)r8rr-r,)
r'r5�firstr2r6r7ZlastZ
first_compZ	last_compr1r(r(r)�_complete_stringRs(#
#	


#z#AutoCompleteWindow._complete_stringcCs�t|jj�d�}|jj|�|j}|j|}|j|�|kr]|}nbtt|�t|��}d}x.||kr�||||kr�|d7}q�W|d|�}|j	|�|j|dt|j
��|j
kr|jjd|jd|j
�n�|jjd|jjd�d|jjd��|jr�|j|_d|_|jjdt�x$|jD]}|jjt|�q�W|jj|j|j
��|j�dS)Nrr+�selectbackground�selectforeground�bgZfg)�intr�curselection�seerrr8r,r-r3rZ	configurerr�cgetrr.�ENDr/�
select_set�_selection_changed)r'�curselZltsZselstartr0r1r2�itemr(r(r)rDqs2	
	#
)
		z%AutoCompleteWindow._selection_changedcCsX|\|_|_||_|jj|�|_|jj|jd�|_|r�|j|j�}|j}|j	|�|j
|�}|j||kr�|t|j�dks�|j|ddt|��|kr�||kS||_|j|_
t|j�|_}	|	jd�|	jd�y#|	jjdd|	jdd�Wntk
raYnXt|	dt�|_}
t|	d	|
jd
ddd
�|_}x!|jD]}|jt|�q�W|jd�|_|jd�|_ |
j!d|j"�|
j#dt$dt%�|j#dt&dt'dd�|	j(�|jj)|j
|j��|j*�|jj+t,|j-�|_.x!t/D]}
|jj0t,|
�q�W|jj+t1|j2�|_3x!t4D]}
|jj0t1|
�q�W|jj+t5|j6�|_7|jj0t5t8�|j+t9|j:�|_;|	j+t<|j=�|_>|j+t?|j@�|_AdS)Nr/r+z+10000+10000z!::tk::unsupported::MacWindowStyle�style�helpZnoActivatesZorientZyscrollcommandZexportselectionFr=Zwhiter<r;ZcommandZside�fill�expandT)Brrrr�indexr�getrr:r3r8r-rrZToplevelr�wm_geometryZwm_overrideredirectZtk�callZ_wZTclErrorZ	ScrollbarZVERTICALrZListbox�setrr/rBrArr�configZyview�packZRIGHT�YZLEFTZBOTHZliftrCrD�bind�HIDE_VIRTUAL_EVENT_NAME�
hide_eventr �HIDE_SEQUENCESZ	event_add�KEYPRESS_VIRTUAL_EVENT_NAME�keypress_eventr!�KEYPRESS_SEQUENCES�KEYRELEASE_VIRTUAL_EVENT_NAME�keyrelease_eventr$�KEYRELEASE_SEQUENCE�LISTUPDATE_SEQUENCE�listselect_eventr"�WINCONFIG_SEQUENCE�winconfig_eventr#�DOUBLECLICK_SEQUENCE�doubleclick_eventr%)r'Z
comp_listsrK�completerZuserWantsWinZ	completedrr2�acwrrrF�seqr(r(r)�show_window�sh		
'
	






		zAutoCompleteWindow.show_windowcCs
|j�sdS|j}|j|j�|j|j�\}}}}|j}|j�|j�}}	|j�|j�}
}|j�t	|t
d|
|��}|j�|}
||||	ks�||	kr�|
|7}
n
|
|	8}
|jd||
f�dS)Nrz+%d+%d)
�	is_activerr@rZbboxrZwinfo_width�winfo_heightZwinfo_rootxr,�maxZwinfo_rootyrM)r'�event�text�x�yZcx�cyrdZ	acw_widthZ
acw_height�
text_widthZtext_heightZnew_xZnew_yr(r(r)r`�s		&

z"AutoCompleteWindow.winconfig_eventcCs|j�sdS|j�dS)N)rg�hide_window)r'rjr(r(r)rU�szAutoCompleteWindow.hide_eventcCsJ|j�sdSd|_t|jj�d�}|j|j|�dS)NTr)rgrr>rr?r3r)r'rjrEr(r(r)r^�s
	z#AutoCompleteWindow.listselect_eventcCs;t|jj�d�}|j|j|�|j�dS)Nr)r>rr?r3rrp)r'rjrEr(r(r)rb�sz$AutoCompleteWindow.doubleclick_eventcs3|j�sdS|j�t|d�r4|j}nd}�dkrOd|_t��dks��d(ks�|jtkr��d)kr�|t@r�t��dkr�|j	|j
��n��dkr�|j	|j
d
�n��dkr|j	|j
d�n`�d	kr&|j	|j
d�n=t|j
�dkrI|j�dS|j	|j
dd*��|j
|_|j
jdt|j
j�d��|j
j|j|j
��|j�d
S�dkr�|j�dS|jtkr��d+ks|jtkr��d,kr�|t@r�t|j
j�d�}|j|dt|j
��|j
kr�|jtksu|j
r�|j	|j|�|j�dS�d-kr|rd|_t|j
j�d�}�dkr�d}n��dkrt|j�d}n��d.kr|j
j|j
j��|j
jd�}�dkr\td||�}q�tt|j�d||�}nB�dkr�td|d�}n tt|j�d|d�}|j
j|�|j
j|�|j�|j	|j|�d
S�dkrs|rs|jrZt|j
j�d�}|j	|j|�|j�d
Sd|_d|_dSn�t�fdd �d/D��r�dS|jr!|jd'kr!|j	|j
|j�|j
|_|j
jdt|j
j�d��|j
j|j|j
��|j�d
S|j�dSdS)0N�mc_staterZTabFr+�
underscore�	BackSpace�period�minus�_�.�-�breakZReturn�space�	parenleft�
parenright�bracketleft�bracketright�slash�	backslash�quotedbl�
apostrophe�Home�End�Prior�Next�Up�DownTc3s|]}|�kVqdS)Nr()�.0r5)�keysymr(r)�	<genexpr>bsz4AutoCompleteWindow.keypress_event.<locals>.<genexpr>�Shift�Control�Alt�Meta�Command�Option� )rrrs)rtru���)rtrzr{r|r}r~)rr�r�r�)r�r�r�r�r�r�)r�r�)r�r�r�r�r�r�)rgr��hasattrrqr&r-rrrr3rrprrZselect_clearr>r?rCr8rDrrrZnearestrhrir,�any�char)r'rj�staterEZnewselZjumpr()r�r)rXs�			
&

		)
		# 
	
		
&

z!AutoCompleteWindow.keypress_eventcCsX|j�sdS|jjd�|jjd|jt|j�f�krT|j�dS)Nr/z%s+%dc)rgrrKrr-rrp)r'rjr(r(r)r[us
+z#AutoCompleteWindow.keyrelease_eventcCs
|jdk	S)N)r)r'r(r(r)rg}szAutoCompleteWindow.is_activecCs|j|j|j��dS)N)r3r:r)r'r(r(r)rc�szAutoCompleteWindow.completecCsL|j�sdSx!tD]}|jjt|�qW|jjt|j�d|_x!tD]}|jjt|�qZW|jjt|j	�d|_	|jjt
t�|jjt
|j�d|_|j
jt|j�d|_|jjt|j�d|_|jj�d|_|j
j�d|_
|jj�d|_dS)N)rgrVrZevent_deleterTZunbindr rYrWr!rZr\r$rr]r"rr_r#rZdestroy)r'rer(r(r)rp�s0
	
				
	
	
zAutoCompleteWindow.hide_windowN)�__name__�
__module__�__qualname__r*r3r8r:rDrfr`rUr^rbrXr[rgrcrpr(r(r(r)rs 

$FsrN)rr)
rr	r
rrr
rrrr)�tkinterZidlelib.MultiCallrZidlelib.AutoCompleterrrTrVrWrYrZr\r]r_rarr(r(r(r)�<module>s


?>