%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/searchbase.cpython-38.pyc

U

qa@sdZddlmZddlmZmZmZmZmZm	Z	ddl
mZGdddZGdddeZ
ed	krdd
lmZeddd
dddlmZee
dS)zBDefine SearchDialogBase used by Search, Replace, and Grep dialogs.)Toplevel)FrameEntryLabelButtonCheckbuttonRadiobutton)
_setup_dialogc@s|eZdZdZdZdZdZddZddd	Zdd
dZ	dd
Z
ddZddZdddZ
ddZddZd ddZddZdS)!SearchDialogBaseayCreate 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.
    z
Search DialogZSearchcCs||_|j|_||_d|_dS)a[Initialize root, engine, and top attributes.

        top (level widget): set in create_widgets() called from open().
        frame: container for all widgets in dialog.
        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_widgets().

        title (of dialog): class attribute, override in subclasses.
        icon (of dialog): ditto, use unclear if cannot minimize dialog.
        N)rootZbellenginetop)selfrr
r./usr/local/lib/python3.8/idlelib/searchbase.py__init__!s
zSearchDialogBase.__init__NcCs||_|js|n|j|j|j||rZ|jdd|j	d||j
|jdd|jd|j
dS)z6Make dialog visible on top of others and ready to use.rendN)textrcreate_widgetsZ	deiconifyZtkraise	transientZwinfo_toplevelentdeleteinsertZ	focus_setZselection_rangeZicursorZgrab_set)rrZsearchphraserrropen3s



zSearchDialogBase.opencCs*|jr&|j|jd|jdS)zPut dialog away for later use.N)rZgrab_releaserZwithdraw)reventrrrcloseDs
zSearchDialogBase.closecCst|j}|d|j|d|j|d|j||j||j	t
|||_t|dd|_
|j
jdd|jdd	d
|jdd	d
d|_|j
jdddd|j
jd
dd	d	d||||dS)zCreate 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.
        z<Return>z<Escape>ZWM_DELETE_WINDOWZ5px)ZpaddingZnwes)stickyrd)weight)padr r)r"Zminsizer N)rrbinddefault_commandrprotocolZwm_titletitleZwm_iconnameiconr	rrframegridZgrid_columnconfigureZgrid_rowconfigurerowcreate_entriescreate_option_buttonscreate_other_buttonscreate_command_buttons)rrrrrrKs&
zSearchDialogBase.create_widgetscCsVt|j|d}|j|jdddt|j|dd}|j|jddd|jd|_||fS)zReturn (entry, label), .

        entry - gridded labeled Entry for text entry.
        label - Label widget, returned for testing.
        rrnwr*columnr)ZtextvariableZexportselectionrnwe)rr(r)r*r)rZ
label_textvarlabelentryrrr
make_entrygszSearchDialogBase.make_entrycCs|d|jjd|_dS)z/Create one or more entry lines with make_entry.zFind:rN)r7r
Zpatvarr)rrrrr+tszSearchDialogBase.create_entriescCs\|r&t|j|d}|j|jdddnd}t|j}|j|jdddd|jd|_||fS)	zReturn (frame, label).

        frame - gridded labeled Frame for option or other buttons.
        label - Label widget, returned for testing.
        r/rr0r1rrr3)r*r2Z
columnspanr)rr(r)r*r)rZ	labeltextr5r(rrr
make_framexs
zSearchDialogBase.make_framecCsx|dd}|j}|jdf|jdf|jdfg}|jrF||jdf|D]$\}}t|||d}|j	dd	d
qJ||fS)aReturn (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.
        ZOptionsrzRegular expressionz
Match casez
Whole wordzWrap around)variablerleftbothZsidefill)
r8r
ZrevarZcasevarZwordvarneedwrapbuttonappendZwrapvarrpack)rr(r
optionsr4r5btnrrrr,sz&SearchDialogBase.create_option_buttonscCsR|dd}|jj}ddg}|D]&\}}t||||d}|jdddq"||fS)	zReturn (frame, others) for testing.

        Others is a list of value, label pairs.
        A gridded frame from make_frame is filled with radio buttons.
        Z	Directionr)rZUp)rZDown)r9valuerr:r;r<)r8r
Zbackvarrr@)rr(r4Zothersvalr5rBrrrr-sz%SearchDialogBase.create_other_buttonsrcCsPt|j|||rdpdd}|j\}}|jd|ddd|jj|dd|S)	z/Return command button gridded in command frame.ZactiveZnormal)rcommanddefaultrrZew)padyr*r2r)Zrowspan)rbuttonframeZ	grid_sizer))rr5rEZisdefbZcolsZrowsrrrmake_buttons
zSearchDialogBase.make_buttoncCs@t|j}|_|jddddddd|d|j}|dS)z9Place buttons in vertical command frame gridded on right.rr!)r*r2ZpadxrGZipadxZipadyCloseN)rr(rHr)rJrlower)rfrIrrrr.sz'SearchDialogBase.create_command_buttons)N)N)N)r)__name__
__module____qualname____doc__r&r'r>rrrrr7r+r8r,r-rJr.rrrrr
s





r
c@s eZdZdZddZddZdS)_searchbasez3Create auto-opening dialog with no text connection.cCs|ddl}ddlm}||_|||_|t|t	t
t|d|\}}}}|j
d|d|dfdS)Nr)searchenginez[x+]z+%d+%d()reZidlelibrSrgetr
rprintZgeometrylistmapintsplitr)rparentrVrSwidthZheightxyrrrrs"z_searchbase.__init__cCsdS)Nr)rdummyrrrr$z_searchbase.default_commandN)rNrOrPrQrr$rrrrrRsrR__main__)mainz!idlelib.idle_test.test_searchbaser!F)	verbosityexit)runN)rQtkinterrZtkinter.ttkrrrrrrZtkinter.simpledialogr	r
rRrNZunittestrdZidlelib.idle_test.htestrgrrrr<module>s 5

Zerion Mini Shell 1.0