I've got an app view I'm putting together with PyQt4, and am implementing a drag and drop feature on a QWebView.
I've got drag and drop working, except that when I drop a folder or file, it gives me some sort of OSX temporary filename (see /.file/id=6571367.6613253/), instead of the actual name and location. I'm wondering, is there any way to extrapolate the real directory or filename with full system path, or worst case at least can I operate on this temporary locator?
I do see an actual .file file on the root directory.
#!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class MainView(QWebView):
def __init__(self):
QWebView.__init__(self)
self.loadFinished.connect(self._result_available)
self.setAcceptDrops(True)
def _result_available(self, ok):
frame = self.page().mainFrame()
def dragEnterEvent(self, event):
if event.mimeData().hasUrls:
event.accept()
else:
event.ignore()
def dragMoveEvent(self, event):
if event.mimeData().hasUrls:
event.setDropAction(Qt.CopyAction)
event.accept()
else:
event.ignore()
def dropEvent(self, event):
if event.mimeData().hasUrls:
event.setDropAction(Qt.CopyAction)
event.accept()
for url in event.mimeData().urls():
print QUrl(url.path())
else:
event.ignore()
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire