PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  pY@sddlmZGdddZGdddZddZedkrdd lZejd d d d dddlm Z e ed S))TclErrorc@s^eZdZdZddZddZddZdd Zd d Zd d Z dS)WidgetRedirectoraSupport for redirecting arbitrary widget subcommands. Some Tk operations don't normally pass through tkinter. For example, if a character is inserted into a Text widget by pressing a key, a default Tk binding to the widget's 'insert' operation is activated, and the Tk library processes the insert without calling back into tkinter. Although a binding to could be made via tkinter, what we really want to do is to hook the Tk 'insert' operation itself. For one thing, we want a text.insert call in idle code to have the same effect as a key press. When a widget is instantiated, a Tcl command is created whose name is the same as the pathname widget._w. This command is used to invoke the various widget operations, e.g. insert (for a Text widget). We are going to hook this command and provide a facility ('register') to intercept the widget operation. We will also intercept method calls on the tkinter class instance that represents the tk widget. In IDLE, WidgetRedirector is used in Percolator to intercept Text commands. The function being registered provides access to the top of a Percolator chain. At the bottom of the chain is a call to the original Tk widget operation. cCsei|_||_|j|_}|j}|d|_|jd||j|j||jdS)aInitialize attributes and setup redirection. _operations: dict mapping operation name to new function. widget: the widget whose tcl command is to be intercepted. tk: widget.tk, a convenience attribute, probably not needed. orig: new name of the original tcl command. Since renaming to orig fails with TclError when orig already exists, only one WidgetDirector can exist for a given widget. Z_origrenameN) _operationswidgettk_worigcallZ createcommanddispatch)selfrrwr//opt/python35/lib/python3.5/WidgetRedirector.py__init__s    zWidgetRedirector.__init__cCs&d|jj|jjj|jjfS)Nz %s(%s<%s>)) __class____name__rr)r rrr__repr__1s  zWidgetRedirector.__repr__cCsux$t|jD]}|j|qW|j}|j}|j}|j||jd|j||`|`dS)zBUnregister operations and revert redirection created by .__init__.rN) listr unregisterrrrZ deletecommandr r )r operationrrr rrrclose6s    zWidgetRedirector.closecCs-||j|.my_insertr,)tkinterr)r*retitlermapintsplitZgeometrypackZ focus_setrrZmainloop) parentr)r*r1rootwidthZheightxytextr%r/r)r.r_widget_redirectors   3    r=__main__Nz"idlelib.idle_test.test_widgetredir verbosityexitF)run) r0rrrr=rZunittestmainZidlelib.idle_test.htestrBrrrrsu!