Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def dropEvent(self, event: QtGui.QDropEvent):
     self.dropSignal.emit()
     event.accept()
Ejemplo n.º 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()
Ejemplo n.º 8
0
 def dropEvent(self, event: QDropEvent):
     files_list = event.mimeData().text().split()
     self.parse_drop_file_list(files_list)
Ejemplo n.º 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()