'dropEvent for dragging files and directories into the widget.'

def dropEvent(self, event):

    if event.mimeData().hasUrls:
        event.setDropAction(QtCore.Qt.CopyAction)
        event.accept()
        for url in event.mimeData().urls():
            filename = str(url.toLocalFile())
            self.add_file(filename)
    else:
        event.ignore()
    self.files_dropped.emit()
