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__/autocomplete_w.cpython-37.opt-2.pyc

B

YI~d�N�@s�ddlZddlTddlmZddlmZmZddlmZdZ	dZ
e
dfZd	Zd
Z
dZdZd
ZdZdZGdd�d�Zedkr�ddlmZedddd�dS)�N)�*)�	Scrollbar)�FILES�ATTRS)�MC_SHIFTz<<autocompletewindow-hide>>z
<FocusOut>z
<ButtonPress>z<<autocompletewindow-keypress>>)z<Key>z<Key-BackSpace>z<Key-Return>z	<Key-Tab>z<Key-Up>z
<Key-Down>z
<Key-Home>z	<Key-End>z<Key-Prior>z
<Key-Next>z<Key-Escape>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�Zdd �Zd!S)"�AutoCompleteWindowcCs�||_d|_|_|_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�userwantswindowZhideid�
keypressid�listupdateid�winconfigid�keyreleaseid�
doubleclickid�lastkey_was_tab�is_configuring)�selfr�r�;/opt/alt/python37/lib64/python3.7/idlelib/autocomplete_w.py�__init__s$zAutoCompleteWindow.__init__cCs�tt|j�t|��}d}x&||kr>|j|||kr>|d7}qW|t|j�krv|j�d|j|fd|jt|j�f�|t|�kr�|j�d|j|f||d��||_dS)Nr�z%s+%dc)�min�lenrr�deleter�insert)r�newstart�min_len�irrr�
_change_start>sz AutoCompleteWindow._change_startcCsXd}t|j�}x4||krB||d}|j||kr8|}q|d}qWt|t|j�d�S)Nr�r )r"rr!)r�sr'�j�mrrr�_binary_searchKs

z!AutoCompleteWindow._binary_searchc
Cs�|�|�}|j|dt|��|kr(|S|d}t|j�}x@||krz||d}|j|dt|��|krp|}q<|d}q<W|d}||kr�|j|S|j|}|j|}tt|�t|��}	t|�}x$||	kr�||||kr�|d7}q�W|d|�S)Nr r))r-rr"r!)
rr*�firstr'r+r,ZlastZ
first_compZ	last_compr&rrr�_complete_stringXs(





z#AutoCompleteWindow._complete_stringcCsLt|j��d�}|j�|�|j}|j|}|�|�|krB|}nHtt|�t|��}d}x$||kr|||||kr||d7}qZW|d|�}|�	|�|j|dt|j
��|j
kr�|jj|j|j
d�n�|jj|j�d�|j�d�d�|j�rH|j|_d|_|j�dt�x|jD]}|j�t|��qW|j�|�|j
��|��dS)Nrr )�selectbackground�selectforeground�bgZfg)�intr
�curselection�seerrr-r!r"r(rZ	configurer
r�cgetrr#�ENDr$�
select_set�_selection_changed)r�curselZltsZselstartr%r&r'�itemrrrr9xs2


z%AutoCompleteWindow._selection_changedcCs�|\|_|_||_|j�|�|_|j�|jd�|_|r�|�|j�}|j}|�	|�|�
|�}|j||kr�|t|j�dks�|j|ddt|��|kr�||kS||_|j|_
t|j�|_}	|	�d�|	�d�y|	j�dd|	jdd�Wntk
�rYnXt|	td�|_}
t|	|
jd	d
�|_}x|jD]}|�t|��q6W|�d�|_|�d�|_ |
j!|j"d
�|
j#t$t%d�|j#t&t'dd�|	�(�|j�)|�
|j��|�*�|	�+t,|j-�|_.|j�+t,|j-�|_/|	�0t,t1�xt2D]}
|j�0t,|
��q�W|j�+t3|j4�|_5xt6D]}
|j�0t3|
��qW|j�+t7|j8�|_9|j�0t7t:�|�+t;|j<�|_=d	|_>|	�+t?|j@�|_A|�+tB|jC�|_DdS)Nr$r z+10000+10000z!::tk::unsupported::MacWindowStyleZstyle�helpZnoActivates)ZorientF)ZyscrollcommandZexportselectionr1r0)Zcommand)�side�fillT)r=r>�expand)Errrr�indexr�getrr/r(r-r"rrZToplevelr	�wm_geometryZwm_overrideredirectZtkZcallZ_wZTclErrorrZVERTICALrZListbox�setr
r$r7r6rr
ZconfigZyview�packZRIGHT�YZLEFTZBOTHZliftr8r9Zbind�HIDE_VIRTUAL_EVENT_NAME�
hide_event�hideaid�hidewidZ	event_add�HIDE_FOCUS_OUT_SEQUENCE�HIDE_SEQUENCES�KEYPRESS_VIRTUAL_EVENT_NAME�keypress_eventr�KEYPRESS_SEQUENCES�KEYRELEASE_VIRTUAL_EVENT_NAME�keyrelease_eventr�KEYRELEASE_SEQUENCE�LISTUPDATE_SEQUENCE�listselect_eventrr�WINCONFIG_SEQUENCE�winconfig_eventr�DOUBLECLICK_SEQUENCE�doubleclick_eventr)rZ
comp_listsr@�completerZuserWantsWinZ	completedrr'�acwrr
r;�seqrrr�show_window�sn









zAutoCompleteWindow.show_windowcCs|jr
dSd|_|��sdS|j}|�|j�|�|j�\}}}}|j}|��|��|�	�}}	|��|�	�}
}|�
�t|td|
|��}|�
�|}
||||	ks�||	kr�|
|7}
n|
|	8}
|�d||
f�|��t���d��r|�t|j�d|_d|_dS)NTrz+%d+%dZWindowsF)r�	is_activerr5rZbboxr	�updateZwinfo_width�winfo_heightZwinfo_rootxr!�maxZwinfo_rootyrBZupdate_idletasks�platform�system�
startswith�unbindrTr)r�event�text�x�yZcx�cyrYZ	acw_widthZ
acw_height�
text_widthZtext_heightZnew_xZnew_yrrrrU�s0
z"AutoCompleteWindow.winconfig_eventcCsB|js
dSy|j��s|��Wntk
r<|��YnXdS)N)r	Z	focus_get�hide_window�KeyError)rrrr�_hide_event_checks
z$AutoCompleteWindow._hide_event_checkcCs>|��r:|jtjkr&|j�d|j�n|jtjkr:|��dS)Nr )	r\�typeZ	EventTypeZFocusOutrZafterrlZButtonPressrj)rrdrrrrGs
zAutoCompleteWindow.hide_eventcCs4|��r0d|_t|j��d�}|�|j|�dS)NTr)r\rr3r
r4r(r)rrdr:rrrrS(sz#AutoCompleteWindow.listselect_eventcCs.t|j��d�}|�|j|�|��dS)Nr)r3r
r4r(rrj)rrdr:rrrrW.sz$AutoCompleteWindow.doubleclick_eventcs|��sdS|j�t|d�r$|j}nd}�dkr6d|_t��dks`�dks`|jtk�rJ�dk�rJ|t@�sJt��dkr�|�	|j
��n|�dkr�|�	|j
d	�nb�d
kr�|�	|j
d�nH�dkr�|�	|j
d
�n.t|j
�dkr�|��dS|�	|j
dd��|j
|_|j
�dt|j
��d��|j
�|�|j
��|��dS�dk�rh|��|��dS|jtk�r~�dk�s�|jtk�r�dk�r|t@�st|j
��d�}|j|dt|j
��|j
k�r�|jtk�s�|j
�r�|�	|j|�|��dS�dk�r|�sd|_t|j
��d�}�dk�r:d}n��dk�rTt|j�d}n��dk�r�|j
�|j
���|j
�d�}�dk�r�td||�}ntt|j�d||�}n2�dk�r�td|d�}ntt|j�d|d�}|j
�|�|j
�|�|��|�	|j|�dS�dk�rn|�sn|j�r\t|j
��d�}|�	|j|�|��dSd|_d|_dSn�t�fdd�dD���r�dS|j�r�|jdk�r�|�	|j
|j�|j
|_|j
�dt|j
��d��|j
�|�|j
��|��dS|��dSdS)N�mc_staterZTabFr )�
underscoreZ	BackSpace)�period�minusro�_rp�.rq�-����breakZReturn)rpZspaceZ	parenleftZ
parenrightZbracketleftZbracketright)ZslashZ	backslashZquotedblZ
apostrophe)�Home�End�Prior�Next�UpZDownTrwrx)ryrzryr{c3s|]}|�kVqdS)Nr)�.0r*)�keysymrr�	<genexpr>�sz4AutoCompleteWindow.keypress_event.<locals>.<genexpr>)ZShiftZControlZAltZMetaZCommandZOption� )r\r}�hasattrrnrr"rrrr(rrjrr
Zselect_clearr3r4r8r-r9rXrrrZnearestr^r_r!�any�char)rrd�stater:ZnewselZjumpr)r}rrM4s�

 





z!AutoCompleteWindow.keypress_eventcCs@|��sdS|j�d�|j�d|jt|j�f�kr<|��dS)Nr$z%s+%dc)r\rr@rr"rrj)rrdrrrrP�s

z#AutoCompleteWindow.keyrelease_eventcCs
|jdk	S)N)r	)rrrrr\�szAutoCompleteWindow.is_activecCs|�|�|j��dS)N)r(r/r)rrrrrX�szAutoCompleteWindow.completecCs(|��sdS|j�tt�xtD]}|j�t|�q W|j�t|j�|j�t|j	�d|_d|_	xt
D]}|j�t|�qhW|j�t|j�d|_|j�t
t�|j�t
|j�d|_|j�t|j�d|_|jr�|j�t|j�d|_|j��|j��d|_|j��d|_|j��d|_dS)N)r\r	Zevent_deleterFrJrKrrcrHrIrNrLrrOrQrr
rRrrrTZ	focus_setrZdestroy)rrZrrrrj�s<





zAutoCompleteWindow.hide_windowN)�__name__�
__module__�__qualname__rr(r-r/r9r[rUrlrGrSrWrMrPr\rXrjrrrrrs !

 &L%
tr�__main__)�mainz%idlelib.idle_test.test_autocomplete_wr)F)�	verbosity�exit)r`ZtkinterZtkinter.ttkrZidlelib.autocompleterrZidlelib.multicallrrFrJrKrLrNrOrQrRrTrVrr�Zunittestr�rrrr�<module>s*G

Hacked By AnonymousFox1.0, Coded By AnonymousFox