Process the QFileOpenEvent, so drag-n-drop to the dock, Applescript tell app "Picard" to open myfile etc. work on OS X.

This commit is contained in:
Andrew Barnert
2010-10-11 14:28:50 -07:00
committed by Philipp Wolfer
parent ef0aec31a1
commit e5d4a5a77c

View File

@@ -286,6 +286,16 @@ class Tagger(QtGui.QApplication):
self.exit()
return res
def event(self, event):
if event.type() == QtCore.QEvent.FileOpen:
f = str(event.file())
self.add_files([f])
# We should just return True here, except that seems to
# cause the event's sender to get a -9874 error, so
# apparently there's some magic inside QFileOpenEvent...
return 1
return QtGui.QApplication.event(self, event)
def _file_loaded(self, result=None, error=None):
file = result
if file is not None and error is None and not file.has_error():