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__/search.cpython-37.opt-1.pyc

B

� f��@s�dZddlmZddlmZddlmZdd�Zdd�Zd	d
�Z	dd�Z
Gd
d�de�Zdd�Ze
dkr�ddlmZedddd�ddlmZee�dS)z�Search dialog for Find, Find Again, and Find Selection
   functionality.

   Inherits from SearchDialogBase for GUI and uses searchengine
   to prepare search pattern.
�)�TclError)�searchengine)�SearchDialogBasecCs.|��}t�|�}t|d�s(t||�|_|jS)z�Return the new or existing singleton SearchDialog instance.

    The singleton dialog saves user entries and preferences
    across instances.

    Args:
        text: Text widget containing the text to be searched.
    �
_searchdialog)Z_rootr�get�hasattr�SearchDialogr)�text�root�engine�r�3/opt/alt/python37/lib64/python3.7/idlelib/search.py�_setups
	

rcCs|�dd�}t|��||�S)a
Open the search dialog.

    Module-level function to access the singleton SearchDialog
    instance and open the dialog.  If text is selected, it is
    used as the search phrase; otherwise, the previous entry
    is used.  No search is done with this command.
    z	sel.firstzsel.last)rr�open)r	�patrrr
�findsrcCst|��|�S)aSRepeat the search for the last pattern and preferences.

    Module-level function to access the singleton SearchDialog
    instance to search again using the user entries and preferences
    from the last dialog.  If there was no prior search, open the
    search dialog; otherwise, perform the search without showing the
    dialog.
    )r�
find_again)r	rrr
r&s	rcCst|��|�S)a�Search for the selected pattern in the text.

    Module-level function to access the singleton SearchDialog
    instance to search using the selected text.  With a text
    selection, perform the search without displaying the dialog.
    Without a selection, use the prior entry as the search phrase
    and don't display the dialog.  If there has been no prior
    search, open the search dialog.
    )r�find_selection)r	rrr
r1s
rc@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)rz%Dialog for finding a pattern in text.cCs t�|�|jd|jdd�dS)z=Create the base search dialog and add a button for Find Next.z	Find NextT)ZisdefN)r�create_widgetsZmake_button�default_command)�selfrrr
rAs
zSearchDialog.create_widgetsNcCs|j��sdS|�|j�dS)z3Handle the Find Next button as the default command.N)r�getprogrr	)rZeventrrr
rGs
zSearchDialog.default_commandcCs|j��s|�|�dS|j��s&dS|j�|�}|r�|\}}|��\}}d||f}d||f}y4|�d�}	|�d�}
|	|kr�|
|kr�|��dSWntk
r�YnX|�	ddd�|�
d||�|�d|j��r�|p�|�|�
d�d	S|��dSd
S)a2Repeat the last search.

        If no search was previously run, open a new search dialog.  In
        this case, no search is done.

        If a search was previously run, the search dialog won't be
        shown and the options from the previous search (including the
        search pattern) will be used to find the next occurrence
        of the pattern.  Next is relative based on direction.

        Position the window to display the located occurrence in the
        text.

        Return True if the search was successful and False otherwise.
        Fz%d.%dz	sel.firstzsel.last�selz1.0�end�insertTN)rZgetpatrrZsearch_text�span�indexZbellr�
tag_remove�tag_addZmark_setZisbackZsee)rr	Zres�line�m�i�j�firstZlastZselfirstZsellastrrr
rMs4





zSearchDialog.find_againcCs&|�dd�}|r|j�|�|�|�S)a/Search for selected text with previous dialog preferences.

        Instead of using the same pattern for searching (as Find
        Again does), this first resets the pattern to the currently
        selected text.  If the selected text isn't changed, then use
        the prior search phrase.
        z	sel.firstzsel.last)rrZsetcookedpatr)rr	rrrr
ryszSearchDialog.find_selection)N)�__name__�
__module__�__qualname__�__doc__rrrrrrrr
r>s

,rcs�ddlm}m}ddlm}m}||�}|�d�tt|�	��
d�dd��\}}|�	d||d	f�||�}|��||d
d�������dd
��fdd�}	||d|	d�}
|
��dS)zDisplay search test box.r)�Toplevel�Text)�Frame�ButtonzTest SearchDialog�+�Nz+%d+%d�Zgray)Zinactiveselectbackgroundrz}This is a sample string.
This is a sample string.
This is a sample string.
This is a sample string.
This is a sample string.
cs.��ddd�t�������ddd�dS)Nrz1.0r)rrrrr)r	rr
�	show_find�sz!_search_dialog.<locals>.show_findzSearch (selection ignored))r	Zcommand)
�tkinterr(r)Ztkinter.ttkr*r+�title�map�intZgeometry�splitZpackr)�parentr(r)r*r+�top�x�y�framer/Zbuttonr)r	r
�_search_dialog�s
 r:�__main__)�mainzidlelib.idle_test.test_search�F)�	verbosity�exit)�runN)r'r0rZidlelibrZidlelib.searchbaserrrrrrr:r$Zunittestr<Zidlelib.idle_test.htestr@rrrr
�<module>s
I

Hacked By AnonymousFox1.0, Coded By AnonymousFox