๎ า๊[ฌ ใ@slddlmZddlmZGdd„dƒZdd„ZedkrhddlmZeeƒnd S) ้)ฺWidgetRedirector)ฺ Delegatorc@s^eZdZdd„Zdd„Zddd„Zddd „Zd d „Zd d „ZdS)ฺ PercolatorcCsw||_t|ƒ|_t|ƒ|_|_|jjd|jƒ|j_|jjd|jƒ|j_g|_ dS)Nฺinsertฺdelete) ฺtextrฺredirrฺtopฺbottomฺregisterrrฺfilters)ฺselfrฉr๚(/usr/lib/python3.4/idlelib/Percolator.pyฺ__init__s  zPercolator.__init__cCsnx&|j|jk r(|j|jƒqWd|_|jjdƒd|_|jjƒd|_d|_dS)N)r r ฺ removefilterฺ setdelegaterฺcloser)r rrrrs   zPercolator.closeNcCs|jj|||ƒdS)N)r r)r ฺindexฺcharsZtagsrrrrszPercolator.insertcCs|jj||ƒdS)N)r r)r Zindex1Zindex2rrrrszPercolator.deletecCsGt|tƒst‚|jdks*t‚|j|jƒ||_dS)N)ฺ isinstancerฺAssertionErrorฺdelegaterr )r ฺfilterrrrฺ insertfilterszPercolator.insertfiltercCsบt|tƒst‚|jdk s*t‚|j}||kr[|j|_|jdƒn[x;|j|k r˜||jk s‚t‚|jƒ|j}q^W|j|jƒ|jdƒdS)N)rrrrr rr Z resetcache)r rฺfrrrr&s     zPercolator.removefilter) ฺ__name__ฺ __module__ฺ __qualname__rrrrrrrrrrrs   rcs~ddl}ddl}Gdd„dtƒ}|jƒ}|jdƒttt|jd|j ƒƒƒƒ\}}}}|j d||dfƒ|j |ƒ} t | ƒ‰|dƒ‰|d ƒ‰‡‡‡fd d †} ‡‡‡fd d †} | j ƒ|j ƒ‰|j|ddd| dˆƒ} | j ƒ|j ƒ‰|j|ddd| dˆƒ} | j ƒ|jƒdS)Nrc@s4eZdZdd„Zdd„Zdd„ZdS)z_percolator..TracercSs||_tj|dƒdS)N)ฺnamerr)r rrrrr:s z$_percolator..Tracer.__init__cWs't|jd|ƒ|jj|ŒdS)Nz: insert)ฺprintrrr)r ฺargsrrrr=sz"_percolator..Tracer.insertcWs't|jd|ƒ|jj|ŒdS)Nz: delete)r rrr)r r!rrrr@sz"_percolator..Tracer.deleteN)rrrrrrrrrrฺTracer9s   r"zTest Percolatorz[x+]z+%d+%d้–ฺt1ฺt2csbˆjƒdkr/ˆjdƒˆjˆƒn/ˆjƒdkr^ˆjdƒˆjˆƒndS)Nr้)ฺgetฺsetrrr)ฺpr$ฺvar1rrฺtoggle1Ls   z_percolator..toggle1csbˆjƒdkr/ˆjdƒˆjˆƒn/ˆjƒdkr^ˆjdƒˆjˆƒndS)Nrr&)r'r(rrr)r)r%ฺvar2rrฺtoggle2Ts   z_percolator..toggle2rZTracer1ZcommandZvariableZTracer2)ZtkinterฺrerZTkฺtitleฺlistฺmapฺintฺsplitZgeometryZTextrZpackZIntVarZ CheckbuttonZmainloop)ฺparentZtkr.r"ฺrootฺwidthZheightฺxฺyrr+r-Zcb1Zcb2r)r)r$r%r*r,rฺ _percolator6s*    3     !  ! r9ฺ__main__)ฺrunN) Zidlelib.WidgetRedirectorrZidlelib.Delegatorrrr9rZidlelib.idle_test.htestr;rrrrฺs 2 0