Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/idlelib/SearchDialogBase.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@sdZddlmZmZmZmZmZmZmZdd
d��YZ	e
dkr{ddlZejddd	�ndS(sBDefine SearchDialogBase used by Search, Replace, and Grep dialogs.i�(tTopleveltFrametEntrytLabeltButtontCheckbuttontRadiobuttontSearchDialogBasecBs�eZdZdZdZdZd�Zdd�Zdd�Z	d�Z
d�Zd	�Zdd
�Z
d�Zd�Zd
d�Zd�ZRS(sCreate most of a 3 or 4 row, 3 column search dialog.

    The left and wide middle column contain:
    1 or 2 labeled text entry lines (make_entry, create_entries);
    a row of standard Checkbuttons (make_frame, create_option_buttons),
    each of which corresponds to a search engine Variable;
    a row of dialog-specific Check/Radiobuttons (create_other_buttons).

    The narrow right column contains command buttons
    (make_button, create_command_buttons).
    These are bound to functions that execute the command.

    Except for command buttons, this base class is not limited to
    items common to all three subclasses.  Rather, it is the Find dialog
    minus the "Find Next" command and its execution function.
    The other dialogs override methods to replace and add widgets.
    s
Search DialogtSearchicCs||_||_d|_dS(s�Initialize root, engine, and top attributes.

        top (level widget): set in create_widgets() called from open().
        text (Text being searched): set in open(), only used in subclasses().
        ent (ry): created in make_entry() called from create_entry().
        row (of grid): 0 in create_widgets(), +1 in make_entry/frame().

        title (of dialog): class attribute, override in subclasses.
        icon (of dialog): ditto, use unclear if cannot minimize dialog.
        N(troottenginetNonettop(tselfR	R
((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyt__init__s		cCs�||_|js|j�n|jj�|jj�|rh|jjdd�|jjd|�n|jj�|jj	dd�|jj
d�|jj�dS(s6Make dialog visible on top of others and ready to use.itendN(ttextRtcreate_widgetst	deiconifyttkraisetenttdeletetinsertt	focus_settselection_rangeticursortgrab_set(R
Rtsearchphrase((s./sys/lib/python2.7/idlelib/SearchDialogBase.pytopen,s		



cCs*|jr&|jj�|jj�ndS(sPut dialog away for later use.N(Rtgrab_releasetwithdraw(R
tevent((s./sys/lib/python2.7/idlelib/SearchDialogBase.pytclose<s	
cCs�t|j�}|jd|j�|jd|j�|jd|j�|j|j�|j|j	�||_
d|_|j
jddddd�|j
jdddd	d
dd
�|j
�|j�|j�|j�dS(s�Create basic 3 row x 3 col search (find) dialog.

        Other dialogs override subsidiary create_x methods as needed.
        Replace and Find-in-Files add another entry row.
        s<Return>s<Escape>tWM_DELETE_WINDOWitpaditweightitminsizeidN(RR	tbindtdefault_commandR tprotocoltwm_titlettitletwm_iconnameticonRtrowtgrid_columnconfiguretcreate_entriestcreate_option_buttonstcreate_other_buttonstcreate_command_buttons(R
R((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyRBs		"


cCs�t|jd|�}|jd|jdddd�t|jd|dd�}|jd|jdd	dd
�|jd	|_|S(sReturn gridded labeled Entry.RR,tcolumnitstickytnwttextvariabletexportselectionitnwe(RRtgridR,R(R
tlabeltvartlte((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyt
make_entryYscCs|jd|jj�|_dS(s/Create one or more entry lines with make_entry.sFind:N(R=R
tpatvarR(R
((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyR.bsc	Cs�|r=t|jd|�}|jd|jdddd�nt|j�}|jd|jdddddd	�|jd|_|S(
s9Return gridded labeled Frame for option or other buttons.RR,R2iR3R4it
columnspanR7(RRR8R,R(R
t	labeltextR;tf((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyt
make_framefs"%cCsw|jd�}t|ddd|jjdd�}|jddd	d
�|jj�re|j�nt|ddd|jjdd�}|jddd	d
�|jj�r�|j�nt|ddd|jj	dd�}|jddd	d
�|jj
�r|j�n|jrst|ddd|jjdd
�}|jddd	d
�|jj
�rs|j�qsndS(s?Fill frame with Checkbuttons bound to SearchEngine booleanvars.tOptionstanchortwtvariableRsRegular expressiontsidetlefttfilltboths
Match cases
Whole wordsWrap aroundN(RBRR
trevartpacktisretselecttcasevartiscasetwordvartiswordtneedwrapbuttontwrapvartiswrap(R
RAtbtn((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyR/ps4	
	
	
		c
Cs�|jd�}t|ddd|jjdddd�}|jd	d
dd�|jj�rk|j�nt|ddd|jjdd
dd�}|jd	d
dd�|jj�s�|j�ndS(s.Fill frame with buttons tied to other options.t	DirectionRDRERFtvalueiRtUpRGRHRIRJitDownN(RBRR
tbackvarRLtisbackRN(R
RARV((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyR0�s	
	ic	Cst|jd|d|d|r$dp'd�}|jj�\}}|jddd|d	d
dd�|jjd
|d�|S(s/Return command button gridded in command frame.RtcommandtdefaulttactivetnormaltpadyiR,R2iR3tewtrowspan(Rtbuttonframet	grid_sizeR8(R
R9R]tisdeftbtcolstrows((s./sys/lib/python2.7/idlelib/SearchDialogBase.pytmake_button�s"c
Csgt|j�}|_|jdddddddddddd�|jd	|j�}|j�d
S(s9Place buttons in vertical command frame gridded on right.R,iR2itpadxRatipadxtipadyR N(RRRdR8RjR tlower(R
RARg((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyR1�s.N(t__name__t
__module__t__doc__R)R+RSRRRR RR=R.RBR/R0RjR1(((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyRs					
	!	
t__main__Ns'idlelib.idle_test.test_searchdialogbaset	verbosityi((
RqtTkinterRRRRRRRRRotunittesttmain(((s./sys/lib/python2.7/idlelib/SearchDialogBase.pyt<module>s4�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.