def dragEnterEvent(self, event): if event.source() is self: return else: data = event.mimeData() links = struct.loadMimeData(data) # drag to ourself or already contained? if any([l.doc() == self.__parent.doc() or not self.__parent.model().validateDragEnter(l) for l in links]): return QtGui.QTreeView.dragEnterEvent(self, event)
def dropMimeData(self, data, action, row, column, parent): if not self.__mutable: return True if action == QtCore.Qt.IgnoreAction: return True if data.hasFormat(struct.LINK_MIME_TYPE): return self.__dropLinks(struct.loadMimeData(data)) if data.hasFormat('text/uri-list'): return self.__dropFile(data, parent) return False