Hi,
ich habe vor ein paar Tagen Python entdeckt und möchte nun gerne ein Projekt umsetzen.
Plattform: Windows
Modul: pythoncom , PyQT4
Problem:
Ich habe ein Windows Programm, welches Drag und Drog Operationen Akzeptiert.
Ich möchte mit Python Dateien aus einem Ordner in den Drag&Drop bereich des oben genannten Porgrammes schicken.
Ist dies überhaupt möglich ?
Meine Ideen:
1. Lokale Datei in ein IDataObject wandeln
2. Pointer zu der IDropSource ermitteln
3. aufurfen von DoDragDrop bzw. Drop
zu 1) habe ich folgendes auf die Reihe gestellt:When the user releases the mouse button to drop the data, the system calls the target's IDropTarget::Drop method. Among the method's parameters is a pointer to the data object's IDataObject interface.
Quelle:MSDN
Code: Alles auswählen
"""
Get QMimeData from Filename
@type path: str
@param path: Absolute Path to File
@type clipboard: bool
@param clipboard: Storing Data in Clipboard
@rtype: QMimeData
@return: Returns the Clipboard Format for the given File
"""
def GenerateMimeData(path, clipboard = False):
data = QtCore.QMimeData()
url = QtCore.QUrl.fromLocalFile(path)
data.setUrls([url])
if clipboard:
instance = QtGui.QApplication([])
instance.clipboard().setMimeData(data)
return data
Ich stehe momentan absolut auf dem trockenen.
Material zum Lesen nehme ich auch gerne entgegen.
Die Dokumentation von pythoncom ist leider mehr als dürftig und bietet keinerlei Ansätze.
liebe Größe Sommerzeit