def dropEvent(self, event: QDropEvent): mimedata = event.mimeData() data = QByteArray(mimedata.data("application/x_nodepath.list")) stream = QDataStream(data, QIODevice.ReadOnly) while not stream.atEnd(): path = stream.readQString() self.parent().add_plot(path) event.acceptProposedAction()
def dropEvent(self, event: QDropEvent) -> None: """Drop file in to our window.""" file = event.mimeData().urls()[0].toLocalFile() if QFileInfo(file).suffix().lower() in set(qt_image_suffix): self.project_widget.set_background_config({'background': file}) else: self.__load_file(file) event.acceptProposedAction()
def dropEvent(self, event: QtGui.QDropEvent): if event.mimeData().hasUrls(): paths = [str(url.toLocalFile()) for url in event.mimeData().urls()] paths.sort() chisurf.run("\n".join([ "chisurf.macros.add_dataset(filename='%s')" % p for p in paths ])) event.acceptProposedAction() else: super().dropEvent(event) self.update()
def dropEvent(self, event: QDropEvent): """ Support for load files by drag and drop. At beginning it check number of files and if it greater than :py:attr:`.files_num` it refuse loading. Otherwise it call :py:meth:`.read_drop` method and this method should be overwritten in sub classes """ if not all(x.isLocalFile() for x in event.mimeData().urls()): QMessageBox().warning( self, "Load error", "Not all files are locally. Cannot load data.", QMessageBox.Ok) paths = [x.toLocalFile() for x in event.mimeData().urls()] if self.files_num != -1 and len(paths) > self.files_num: QMessageBox.information( self, "To many files", "currently support only drag and drop one file") return self.read_drop(paths)
def dropEvent(self, event: QtGui.QDropEvent): self.dropSignal.emit() event.accept()
def dropEvent(self, event: QtGui.QDropEvent): if event.mimeData().objectName() == 'frame': self.resetStyle() self.insert_here.emit(self) event.setDropAction(QtCore.Qt.MoveAction) event.accept()
def dropEvent(self, event: QDropEvent): files_list = event.mimeData().text().split() self.parse_drop_file_list(files_list)
def dropEvent(self, event: QDropEvent) -> None: """Drop file in to our window.""" mime_data: QMimeData = event.mimeData() self.__load_file(mime_data.urls()[0].toLocalFile()) event.acceptProposedAction()