Hacked By AnonymousFox

Current Path : /opt/alt/python27/lib64/python2.7/idlelib/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyc

�
^
bc@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(syCreate 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, its execution function, and the
    default_command attribute needed in create_widgets. The other
    dialogs override attributes and methods, the latter 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 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().
        default_command: set in subclasses, used in create_widgers().

        title (of dialog): class attribute, override in subclasses.
        icon (of dialog): ditto, use unclear if cannot minimize dialog.
        N(troottenginetNonettop(tselfR	R
((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyt__init__s		cCs�||_|js|j�n|jj�|jj�|jj|j��|r~|jjdd�|jj	d|�n|jj
�|jjdd�|jjd�|jj
�dS(s6Make dialog visible on top of others and ready to use.itendN(ttextRtcreate_widgetst	deiconifyttkraiset	transienttwinfo_topleveltenttdeletetinsertt	focus_settselection_rangeticursortgrab_set(R
Rtsearchphrase((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pytopen/s		



cCs:|jr6|jj�|jjd�|jj�ndS(sPut dialog away for later use.tN(Rtgrab_releaseRtwithdraw(R
tevent((s=/opt/alt/python27/lib64/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=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyRGs		"


cCs�t|jd|�}|jd|jdddd�t|jd|dd�}|jd|jdd	dd
�|jd	|_||fS(s�Return (entry, label), .

        entry - gridded labeled Entry for text entry.
        label - Label widget, returned for testing.
        RR/tcolumnitstickytnwttextvariabletexportselectionitnwe(RRtgridR/R(R
t
label_texttvartlabeltentry((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyt
make_entry^scCs#|jd|jj�d|_dS(s/Create one or more entry lines with make_entry.sFind:iN(R@R
tpatvarR(R
((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyR1ksc	Cs�|r=t|jd|�}|jd|jdddd�nd}t|j�}|jd|jddd	ddd
�|jd|_||fS(s�Return (frame, label).

        frame - gridded labeled Frame for option or other buttons.
        label - Label widget, returned for testing.
        RR/R5iR6R7Rit
columnspanR:(RRR;R/R(R
t	labeltextR>tframe((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyt
make_frameos"%c	Cs�|jd�d}|j}|jdf|jdf|jdfg}|jrh|j|jdf�nxa|D]Y\}}t|ddd	|d
|�}|j	ddd
d�|j
�ro|j�qoqoW||fS(sReturn (filled frame, options) for testing.

        Options is a list of SearchEngine booleanvar, label pairs.
        A gridded frame from make_frame is filled with a Checkbutton
        for each pair, bound to the var, with the corresponding label.
        tOptionsisRegular expressions
Match cases
Whole wordsWrap aroundtanchortwtvariableRtsidetlefttfilltboth(RER
trevartcasevartwordvartneedwrapbuttontappendtwrapvarRtpacktgettselect(R
RDR
toptionsR=R>tbtn((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyR2s		cCs�|jd�d}|jj}ddg}xm|D]e\}}t|ddd|d	|d
|�}|jddd
d�|j�|kr2|j�q2q2W||fS(s�Return (frame, others) for testing.

        Others is a list of value, label pairs.
        A gridded frame from make_frame is filled with radio buttons.
        t	DirectioniitUptDownRGRHRItvalueRRJRKRLRM(iRZ(iR[(RER
tbackvarRRTRURV(R
RDR=totherstvalR>RX((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyR3�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/R5iR6tewtrowspan(Rtbuttonframet	grid_sizeR;(R
R>R`tisdeftbtcolstrows((s=/opt/alt/python27/lib64/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/iR5itpadxRdtipadxtipadyR#N(RRRgR;RmR#tlower(R
tfRj((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyR4�s.N(t__name__t
__module__t__doc__R,R.RQRRRR#RR@R1RER2R3RmR4(((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyRs			
			
t__main__Ns'idlelib.idle_test.test_searchdialogbaset	verbosityi((
RutTkinterRRRRRRRRRstunittesttmain(((s=/opt/alt/python27/lib64/python2.7/idlelib/SearchDialogBase.pyt<module>s4�

Hacked By AnonymousFox1.0, Coded By AnonymousFox