<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

YfKE              
   @   s   d  Z  d d l Td d l m Z d d l m Z m Z d Z d Z d Z	 d Z
 d Z d Z d Z d Z d Z Gd d   d  Z d S)zH
An auto-completion window for IDLE, used by the AutoComplete extension
    )*)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   e  Z 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 S) AutoCompleteWindowc             C   s   | |  _  d  |  _ |  _ |  _ d  |  _ |  _ d  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d  |  _ d  |  _ |  _ |  _ |  _ |  _ |  _ d |  _ d  S)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(   ?/opt/alt/python35/lib64/python3.5/idlelib/AutoCompleteWindow.py__init__   s    								,zAutoCompleteWindow.__init__c             C   s   t  t |  j  t |   } d } x1 | | k  rW |  j | | | k rW | d 7} q' W| t |  j  k  r |  j j d |  j | f d |  j t |  j  f  | t |  k  r |  j j d |  j | f | | d    | |  _ d  S)Nr      z%s+%dc)minlenr   r   deleter   insert)r'   newstartmin_lenir(   r(   r)   _change_start8   s    &z AutoCompleteWindow._change_startc             C   sv   d } t  |  j  } xD | | k r[ | | d } |  j | | k rN | } q | d } q Wt | t  |  j  d  S)zFind the first index in self.completions where completions[i] is
        greater or equal to s, or the last index if there is no such
        one.r      r+   )r-   r   r,   )r'   sr2   jmr(   r(   r)   _binary_searchE   s     	z!AutoCompleteWindow._binary_searchc       
      C   sG  |  j  |  } |  j | d t |   | k r6 | S| d } t |  j  } xT | | k r | | d } |  j | d t |   | k r | } qR | d } qR W| d } | | k r |  j | S|  j | } |  j | } t t |  t |   }	 t |  } x. | |	 k  r8| | | | k r8| d 7} qW| d |  S)zAssuming that s is the prefix of a string in self.completions,
        return the longest string which is a prefix of all the strings which
        s is a prefix of them. If s is not a prefix of a string, return s.Nr+   r4   )r8   r   r-   r,   )
r'   r5   firstr2   r6   r7   ZlastZ
first_compZ	last_compr1   r(   r(   r)   _complete_stringR   s(    #
#	
#z#AutoCompleteWindow._complete_stringc             C   s  t  |  j j   d  } |  j j |  |  j } |  j | } |  j |  | k r] | } nb t t |  t |   } d } x. | | k  r | | | | k r | d 7} q W| d |  } |  j	 |  |  j | d t |  j
   |  j
 k r|  j j d |  j d |  j  n |  j j d |  j j d  d |  j j d   |  j r|  j |  _ d |  _ |  j j d t  x$ |  j D] } |  j j t |  qW|  j j |  j |  j
   |  j   d S)z|Should be called when the selection of the Listbox has changed.
        Updates the Listbox display and calls _change_start.r   r+   NselectbackgroundselectforegroundbgZfg)intr   curselectionseer   r   r8   r,   r-   r3   r   Z	configurer   r   cgetr   r.   ENDr/   
select_set_selection_changed)r'   curselZltsZselstartr0   r1   r2   itemr(   r(   r)   rD   q   s2    		#)		z%AutoCompleteWindow._selection_changedc             C   sX  | \ |  _  |  _ | |  _ |  j j |  |  _ |  j j |  j d  |  _ | r |  j |  j  } |  j } |  j	 |  |  j
 |  } |  j  | | k r | t |  j   d k s |  j  | d d t |   | k r | | k S| |  _ |  j |  _ t |  j  |  _ }	 |	 j d  |	 j d  y# |	 j j d d |	 j d d  Wn t k
 raYn Xt |	 d	 t |  _ }
 t |	 d
 |
 j d d d d |  _ } x! |  j  D] } | j t |  qW| j d  |  _ | j d  |  _  |
 j! d | j"  |
 j# d t$ d t%  | j# d t& d t' d d  |	 j(   |  j j) |  j
 |  j   |  j*   |  j j+ t, |  j-  |  _. x! t/ D] } |  j j0 t, |  qW|  j j+ t1 |  j2  |  _3 x! t4 D] } |  j j0 t1 |  qW|  j j+ t5 |  j6  |  _7 |  j j0 t5 t8  | j+ t9 |  j:  |  _; |	 j+ t< |  j=  |  _> | j+ t? |  j@  |  _A d S)zShow the autocomplete list, bind events.
        If complete is True, complete the text, and if there is exactly one
        matching completion, don't open a list.r/   r+   Nz+10000+10000z!::tk::unsupported::MacWindowStyleZstylehelpZnoActivatesZorientZyscrollcommandZexportselectionFr=   Zwhiter<   r;   ZcommandZsideZfillexpandT)Br   r   r   r   indexr   getr   r:   r3   r8   r-   r   r   ZToplevelr   wm_geometryZwm_overrideredirectZtkZcallZ_wZTclErrorZ	ScrollbarZVERTICALr   ZListboxsetr   r/   rB   rA   r   r   configZyviewZpackZRIGHTYZLEFTZBOTHZliftrC   rD   Z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_listsrI   completer   ZuserWantsWinZ	completedr   r2   acwr   r   rF   seqr(   r(   r)   show_window   sh    		'
	

		zAutoCompleteWindow.show_windowc             C   s
  |  j    s d  S|  j } | j |  j  | j |  j  \ } } } } |  j } | j   | j   } }	 | j   | j   }
 } | j   t	 | t
 d |
 |   } | j   | } | | | |	 k s | |	 k  r | | 7} n
 | |	 8} | j d | | f  d  S)Nr   z+%d+%d)	is_activer   r@   r   Zbboxr   Zwinfo_widthwinfo_heightZwinfo_rootxr,   maxZwinfo_rootyrK   )r'   eventtextxyZcxZcyr_   Z	acw_widthZ
acw_heightZ
text_widthZtext_heightZnew_xZnew_yr(   r(   r)   r[      s    		&
z"AutoCompleteWindow.winconfig_eventc             C   s   |  j    s d  S|  j   d  S)N)rb   hide_window)r'   re   r(   r(   r)   rP      s    zAutoCompleteWindow.hide_eventc             C   sJ   |  j    s d  Sd |  _ t |  j j   d  } |  j |  j |  d  S)NTr   )rb   r   r>   r   r?   r3   r   )r'   re   rE   r(   r(   r)   rY      s
    	z#AutoCompleteWindow.listselect_eventc             C   s;   t  |  j j   d  } |  j |  j |  |  j   d  S)Nr   )r>   r   r?   r3   r   ri   )r'   re   rE   r(   r(   r)   r]      s    z$AutoCompleteWindow.doubleclick_eventc                s3  |  j    s d  S| j   t | d  r4 | j } n d }   d k rO d |  _ t    d k s   d( k s |  j t k r  d) k r| t @rt    d k r |  j	 |  j
    n   d k r |  j	 |  j
 d
  n   d k r|  j	 |  j
 d  n`   d	 k r&|  j	 |  j
 d  n= t |  j
  d k rI|  j   d  S|  j	 |  j
 d  d*   |  j
 |  _ |  j j d t |  j j   d   |  j j |  j |  j
   |  j   d S  d k r|  j   d  S|  j t k r  d+ k s|  j t k r  d, k r| t @rt |  j j   d  } |  j | d  t |  j
   |  j
 k r|  j t k su|  j
 r|  j	 |  j |  |  j   d  S  d- k r| rd |  _ t |  j j   d  }   d k rd } n   d k rt |  j  d } n   d. k r|  j j |  j j    |  j j d  }   d k r\t d | |  } qt t |  j  d | |  } nB   d k rt d | d  } n  t t |  j  d | d  } |  j j |  |  j j |  |  j   |  j	 |  j |  d S  d k rs| rs|  j rZt |  j j   d  } |  j	 |  j |  |  j   d Sd |  _ d |  _ d  Sn t   f d d    d/ D  rd  S| j r!| j d' k r!|  j	 |  j
 | j  |  j
 |  _ |  j j d t |  j j   d   |  j j |  j |  j
   |  j   d S|  j   d  Sd  S)0Nmc_stater   ZTabFr+   
underscore	BackSpaceperiodminus_.-breakZReturnspace	parenleft
parenrightbracketleftbracketrightslash	backslashquotedbl
apostropheHomeEndPriorNextUpDownTc             3   s   |  ] } |   k Vq d  S)Nr(   ).0r5   )keysymr(   r)   	<genexpr>b  s    z4AutoCompleteWindow.keypress_event.<locals>.<genexpr>ShiftControlAltMetaCommandOption )rk   rl   )rm   rn   )rm   rs   rt   ru   rv   rw   )rx   ry   rz   r{   )r|   r}   r~   r   r   r   )r~   r   )r   r   r   r   r   r   )rb   r   hasattrrj   r&   r-   r   r   r   r3   r   ri   r   r   Zselect_clearr>   r?   rC   r8   rD   r   r   r   Znearestrc   rd   r,   anychar)r'   re   staterE   ZnewselZjumpr(   )r   r)   rS     s    			
&

 		)
		# 
	
		&

z!AutoCompleteWindow.keypress_eventc             C   sX   |  j    s d  S|  j j d  |  j j d |  j t |  j  f  k rT |  j   d  S)Nr/   z%s+%dc)rb   r   rI   r   r-   r   ri   )r'   re   r(   r(   r)   rV   u  s
    +z#AutoCompleteWindow.keyrelease_eventc             C   s   |  j  d  k	 S)N)r   )r'   r(   r(   r)   rb   }  s    zAutoCompleteWindow.is_activec             C   s   |  j  |  j |  j   d  S)N)r3   r:   r   )r'   r(   r(   r)   r^     s    zAutoCompleteWindow.completec             C   sL  |  j    s d  Sx! t D] } |  j j t |  q W|  j j t |  j  d  |  _ x! t D] } |  j j t |  qZ W|  j j t |  j	  d  |  _	 |  j j t
 t  |  j j t
 |  j  d  |  _ |  j j t |  j  d  |  _ |  j j t |  j  d  |  _ |  j j   d  |  _ |  j j   d  |  _ |  j j   d  |  _ d  S)N)rb   rQ   r   Zevent_deleterO   Zunbindr    rT   rR   r!   rU   rW   r$   r   rX   r"   r   rZ   r#   r   Zdestroy)r'   r`   r(   r(   r)   ri     s0    							zAutoCompleteWindow.hide_windowN)__name__
__module____qualname__r*   r3   r8   r:   rD   ra   r[   rP   rY   r]   rS   rV   rb   r^   ri   r(   r(   r(   r)   r      s    $Fsr   N)r   r   )
r   r	   r
   r   r   r   r   r   r   r   )__doc__ZtkinterZidlelib.MultiCallr   Zidlelib.AutoCompleter   r   rO   rQ   rR   rT   rU   rW   rX   rZ   r\   r   r(   r(   r(   r)   <module>   s   
  