def dropEvent(self, event): """Reimplement Qt method Unpack dropped data and handle it""" source = event.mimeData() fnames = [path for path in mimedata2url(source) if osp.isfile(path)] self.add_packages(fnames) event.acceptProposedAction()
def dragEnterEvent(self, event): """Reimplement Qt method Inform Qt about the types of data that the widget accepts""" source = event.mimeData() if source.hasUrls() and mimedata2url(source): event.acceptProposedAction()