nukescripts.drop

Package nukescripts :: Module drop |
[hide private]
[frames] | no frames]

# Source Code for Module nukescripts.drop

     1  # Copyright (c) 2010 The Foundry Visionmongers Ltd.  All Rights Reserved.
     2
     3  _gDropDataCallbacks = []
     4
     5 -def addDropDataCallback(callback):
     6    """Add a function to the list of callbacks. This function will called whenever data is dropped onto the DAG. Override it to perform other actions.
     7    If you handle the drop, return True, otherwise return None."""
     8    _gDropDataCallbacks.append(callback)
     9
    10 -def dropData(mimeType, text):
    11    """Handle data drops by invoking the list of callback functions until one has
    12       handled the event"""
    13    for callback in reversed(_gDropDataCallbacks):
    14      if callback(mimeType, text) == True:
    15        return True
    16    return None
    17