def dropEvent(self, e):
        """ Handles a Python object being dropped on the tree.
        """
        editor = self.parent()._qt4_editor

        klass = editor.factory.klass

        if editor.factory.binding:
            value = getattr(clipboard, 'node', None)
        else:
            value = e.mimeData().instance()

        if (klass is None) or isinstance(value, klass):
            editor._no_update = True
            try:
                if hasattr( value, 'drop_editor_value' ):
                    editor.value = value.drop_editor_value()
                else:
                    editor.value = value
                if hasattr( value, 'drop_editor_update' ):
                    value.drop_editor_update(self)
                else:
                    self.setText(editor.str_value)
            finally:
                editor._no_update = False

            e.acceptProposedAction()

    #---------------------------------------------------------------------------
    #  Handles a Python object being dragged over the control:
    #---------------------------------------------------------------------------
dataset/ETHPy150Open enthought/traitsui/traitsui/qt4/drop_editor.py/_DropEventFilter.dropEvent/original