示例#1
0
 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()
示例#2
0
 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()
示例#3
0
 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()
示例#4
0
 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()
示例#5
0
 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)
示例#6
0
 def dropEvent(self, event: QtGui.QDropEvent):
     self.dropSignal.emit()
     event.accept()
示例#7
0
 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()
示例#8
0
 def dropEvent(self, event: QDropEvent):
     files_list = event.mimeData().text().split()
     self.parse_drop_file_list(files_list)
示例#9
0
 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()