tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[\¬Qc@sSddlTdd    d„ƒYZdd
d„ƒYZd„ZedkrOeƒndS( iÿÿÿÿ(t*tWidgetRedirectorcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(säSupport 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 <Key> could be made via Tkinter, what we really want
    to do is to hook the Tk 'insert' operation itself.
 
    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.
 
    In IDLE, 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||jƒdS(Nt_origtrename(t _operationstwidgetttkt_wtorigtcallt createcommandtdispatch(tselfRRtw((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyt__init__s             cCsd|jjj|jjfS(NsWidgetRedirector(%s<%s>)(Rt    __class__t__name__R(R ((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyt__repr__&scCs{x$t|jƒD]}|j|ƒqW|j}|`|j}|`|j}|j}|j|ƒ|jd||ƒdS(NR(    tlistRt
unregisterRRRRt deletecommandR    (R t    operationRRRR ((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pytclose*s                 cCs-||j|<t|j||ƒt||ƒS(N(RtsetattrRtOriginalCommand(R Rtfunction((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pytregister5s cCsW||jkrO|j|}|j|=t|j|ƒrKt|j|ƒn|SdSdS(N(RthasattrRtdelattrtNone(R RR((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyR:s 
cGs\|jj|ƒ}y1|r%||ŒS|jj|j|f|ƒSWntk
rWdSXdS(sCallback from Tcl which runs when the widget is referenced.
 
        If an operation has been registered in self._operations, apply the
        associated function to the args passed into Tcl. Otherwise, pass the
        operation through to Tk via the original Tcl function.
 
        Note that if a registered function is called, the operation is not
        passed through to Tk.  Apply the function returned by self.register()
        to *args to accomplish that.  For an example, see ColorDelegator.py.
 
        tN(RtgetRR    RtTclError(R Rtargstm((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyR Ds 
! (    Rt
__module__t__doc__RRRRRR (((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyRs                    
RcBs#eZd„Zd„Zd„ZRS(cCsR||_||_|j|_|j|_|jj|_|j|jf|_dS(N(tredirRRRR    ttk_calltorig_and_operation(R R%R((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyR\s           cCsd|j|jfS(NsOriginalCommand(%r, %r)(R%R(R ((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyRdscGs|j|j|ƒS(N(R&R'(R R!((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyt__call__gs(RR#RRR((((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyRZs        cCs™tƒ}|jd|jƒtƒ}|jƒ|jƒt|ƒ}d„}|jd|ƒa|j    ƒ|j
dƒ|j ƒ|j    ƒ|j ƒdS(NtWM_DELETE_WINDOWcWsdG|GHt|ŒdS(Ntinsert(tprevious_tcl_fcn(R!((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyt    my_insertss    R*( tTkt wm_protocoltquittTexttpackt    focus_setRRR+tmainloopRRtdestroy(trootttextR%R,((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pytmainks        
 
     
 
 
t__main__N(((tTkinterRRR7R(((s`/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/WidgetRedirector.pyt<module>s
 
W