Your IP : 3.14.129.86


Current Path : /lib64/python2.7/idlelib/
Upload File :
Current File : //lib64/python2.7/idlelib/WidgetRedirector.pyo

�
�mec@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((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyt__init__s			
cCsd|jjj|jjfS(NsWidgetRedirector(%s<%s>)(Rt	__class__t__name__R(R((s0/usr/lib64/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
((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pytclose*s				
cCs-||j|<t|j||�t||�S(N(RtsetattrRtOriginalCommand(RRtfunction((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pytregister5s
cCsW||jkrO|j|}|j|=t|j|�rKt|j|�n|SdSdS(N(RthasattrRtdelattrtNone(RRR((s0/usr/lib64/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((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyRDs
!
(	Rt
__module__t__doc__RRRRRR(((s0/usr/lib64/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((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyR\s		cCsd|j|jfS(NsOriginalCommand(%r, %r)(R%R(R((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyRdscGs|j|j|�S(N(R&R'(RR!((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyt__call__gs(RR#RRR((((s0/usr/lib64/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!((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyt	my_insertss	R*(
tTktwm_protocoltquittTexttpackt	focus_setRRR+tmainloopRRtdestroy(trootttextR%R,((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pytmainks		

	



t__main__N(((tTkinterRRR7R(((s0/usr/lib64/python2.7/idlelib/WidgetRedirector.pyt<module>s

W