示例#1
0
    def dropEvent(self, event):
        """
        Called when item is dropped onto the matrix grid

        If it's a filename-like item, try to load a matrix
        from the file. Otherwise ignore it
        """
        if event.mimeData().hasUrls:
            event.setDropAction(QtCore.Qt.CopyAction)
            event.accept()
            for url in event.mimeData().urls():
                self._load_file(local_file_from_drop_url(url))
        else:
            event.ignore()
示例#2
0
 def dropEvent(self, drag_data):
     """
     Called when a file or files are dropped on to the interface
     """
     if drag_data.mimeData().hasUrls:
         drag_data.setDropAction(QtCore.Qt.CopyAction)
         drag_data.accept()
         fnames = []
         for url in drag_data.mimeData().urls():
             fnames.append(local_file_from_drop_url(url))
         self.raise_()
         self.activateWindow()
         for fname in fnames:
             self.load_data_interactive(fname)
     else:
         drag_data.ignore()