Changeset - b7e1d080ef64
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 12 years ago 2013-01-15 21:04:50
drewp@bigasterisk.com
ability to abort a registered drag action
Ignore-this: 281c88d9dc644c3d2ac59f5c1e67e75d
1 file changed with 9 insertions and 4 deletions:
0 comments (0 inline, 0 general)
light9/tkdnd.py
Show inline comments
 
@@ -69,25 +69,30 @@ def initTkdnd(tk, tkdndBuildDir):
 
                'tkdnd')
 

	
 
def dragSourceRegister(widget,
 
                       action='copy', datatype='text/uri-list', data=''):
 
    """
 
    if the 'data' param is callable, it will be called every time to
 
    look up the current data
 
    look up the current data.
 

	
 
    If the callable returns None (or data is None to begin with), the drag
 
    """
 
    widget.tk.call('tkdnd::drag_source', 'register', widget._w)
 

	
 
    # with normal Tkinter bind(), the result of your handler isn't
 
    # actually returned so the drag doesn't get launched. This is a
 
    # corrected version of what bind() does when you pass a function,
 
    # but I don't block my tuple from getting returned (as a tcl list)
 

	
 
    def init():
 
        return (action, datatype, data() if callable(data) else data)
 
    
 
    funcId = widget._register(init, 
 
        dataValue = data() if callable(data) else data
 
        if dataValue is None:
 
            return
 
        return (action, datatype, dataValue)
 

	
 
    funcId = widget._register(init,
 
                              widget._substitute,
 
                              1 # needscleanup
 
                              )
 
    widget.bind("<<DragInitCmd>>", funcId)
 

	
 
def dropTargetRegister(widget, typeList=None,
0 comments (0 inline, 0 general)