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

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


�`^c@s ddlZddlZddlZddlZddlmZmZmZddlmZm	Z	m
Z
mZmZddl
mZddlZddlmZddd�Zdefd��YZd	�Zed
krddlZejddd
de�ddlmZee�ndS(i�N(t	StringVart
BooleanVartCheckbutton(tTktTexttButtontSELtEND(tSearchEngine(tSearchDialogBasecCst|j�}tj|�}t|d�sBt|||�|_n|j}|jdd�}|j|||�dS(Nt_grepdialogs	sel.firstssel.last(t_rootRtgetthasattrt
GrepDialogR
topen(ttexttiotflisttroottenginetdialogtsearchphrase((s(/sys/lib/python2.7/idlelib/GrepDialog.pytgrep
s	RcBsteZdZdZdZd�Zdd�Zd�Zd�Z	d�Z
dd�Zd	�Zd
�Z
dd�ZRS(
sFind in Files DialogtGrepicCs>tj|||�||_t|�|_t|�|_dS(N(R	t__init__RRtglobvarRtrecvar(tselfRRR((s(/sys/lib/python2.7/idlelib/GrepDialog.pyRs	c	Cs�tj|||�|r+|jp%d}nd}tjj|�\}}tjj|�\}}|spd}n|jjtjj	|d|��dS(Nts.pyt*(
R	RtfilenametostpathtsplittsplitextRtsettjoin(	RRRRR!tdirtbasetheadttail((s(/sys/lib/python2.7/idlelib/GrepDialog.pyR"s	cCs)tj|�|jd|j�|_dS(Ns	In files:(R	tcreate_entriest
make_entryRtglobent(R((s(/sys/lib/python2.7/idlelib/GrepDialog.pyR*.s
cCsQ|j�}t|ddd|jdd�}|jdddd	�|j�dS(
NtanchortwtvariableRsRecurse down subdirectoriestsidettoptfilltboth(t
make_frameRRtpacktselect(Rtftbtn((s(/sys/lib/python2.7/idlelib/GrepDialog.pytcreate_other_buttons2s		cCs'tj|�|jd|jd�dS(NsSearch Filesi(R	tcreate_command_buttonstmake_buttontdefault_command(R((s(/sys/lib/python2.7/idlelib/GrepDialog.pyR:;s
cCs�|jj�}|sdS|jj�}|s?|jj�dSddlm}tj	}z&||j
�t_	|j||�Wd|t_	XdS(Ni�(tOutputWindow(RtgetprogRRR1tbelltidlelib.OutputWindowR=tsyststdoutRtgrep_it(RteventtprogR!R=tsave((s(/sys/lib/python2.7/idlelib/GrepDialog.pyR<?s
	c
CsZtjj|�\}}|j|||jj��}|j�|j�|jj	�}d||fGHd}y�x�|D]�}y�t
|��}	xst|	d�D]b\}
}|ddkr�|d }n|j|�r�t
jjd||
|f�|d7}q�q�WWdQXWqxtk
r'}|GHqxXqxW|r<d|ndGHWntk
rUnXdS(	NsSearching %r in %s ...iii�s
s%s: %s: %s
s5Hits found: %s
(Hint: right-click to open locations.)sNo hits.(R R!R"t	findfilesRRtsorttcloseRtgetpatRt	enumeratetsearchRARBtwritetIOErrortAttributeError(
RRER!R&R'tlisttpatthitstfnR7tlinenotlinetmsg((s(/sys/lib/python2.7/idlelib/GrepDialog.pyRCOs.





cCs�ytj|ptj�}Wntjk
r:}|GHgSXg}g}xg|D]_}tjj||�}	tjj|	�r�|j|	�qNtj||�rN|j|	�qNqNW|r�-|D]"}
|j	|j
|
||��q�Wn|S(N(R tlistdirtcurdirterrorR!R%tisdirtappendtfnmatchtextendRG(RR&R'trectnamesRVRPtsubdirstnameRStsubdir((s(/sys/lib/python2.7/idlelib/GrepDialog.pyRGls"

#cCs*|jr&|jj�|jj�ndS(N(R1tgrab_releasetwithdraw(RRD((s(/sys/lib/python2.7/idlelib/GrepDialog.pyRI�s	
N(t__name__t
__module__ttitleticontneedwrapbuttonRtNoneRR*R9R:R<RCRGRI(((s(/sys/lib/python2.7/idlelib/GrepDialog.pyRs							c	s�ddlm}t�}|jd�ttttjd|j	����\}}}}|j	d||df�||��t
|dd���j���fd	�}t|d
dd|�}|j�|j
�dS(
Ni�(tPyShellFileListsTest GrepDialogs[x+]s+%d+%di�theightics:�jtdt�t�d���jtdt�dS(Ns1.0R(ttag_addRRRt
tag_remove((RR(s(/sys/lib/python2.7/idlelib/GrepDialog.pytshow_grep_dialog�sRsShow GrepDialogtcommand(tidlelib.PyShellRkRRgRPtmaptinttreR"tgeometryRR5Rtmainloop(	tparentRkRtwidthRltxtyRotbutton((RRs(/sys/lib/python2.7/idlelib/GrepDialog.pyt_grep_dialog�s	
3

t__main__sidlelib.idle_test.test_grept	verbosityitexit(trun(R R\RtRAtTkinterRRRRRRRRtidlelibRt	itertoolstidlelib.SearchDialogBaseR	RjRRR|RetunittesttmaintFalsetidlelib.idle_test.htestR�(((s(/sys/lib/python2.7/idlelib/GrepDialog.pyt<module>s (	p	

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.