diff options
-rw-r--r-- | module/gui/Collector.py | 2 | ||||
-rwxr-xr-x | pyLoadGui.py | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/module/gui/Collector.py b/module/gui/Collector.py index 07a5203e9..1b1a6b654 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -88,7 +88,7 @@ class PackageCollector(QThread): item = newPack item.setData(0, Qt.DisplayRole, QVariant(item.getPackData()["package_name"])) item.setData(0, Qt.UserRole, QVariant(pid)) - item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) + item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDropEnabled) def getPack(self, pid): for k, pack in enumerate(ItemIterator(self.rootItem)): diff --git a/pyLoadGui.py b/pyLoadGui.py index 5ce098fa0..7ef267fcb 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -166,7 +166,15 @@ class main(QObject): event.accept() view = event.source() if view == klass: - event.ignore() + items = view.selectedItems() + for item in items: + if not hasattr(item.parent(), "getPackData"): + continue + target = view.itemAt(event.pos()) + if not hasattr(target, "getPackData"): + target = target.parent() + klass.emit(SIGNAL("droppedToPack"), target.getPackData()["id"], item.getFileData()["id"]) + event.accept() return items = view.selectedItems() for item in items: @@ -192,6 +200,7 @@ class main(QObject): view.setDragDropMode(QAbstractItemView.DragDrop) view.setDropIndicatorShown(True) view.setDragDropOverwriteMode(True) + self.connect(view, SIGNAL("droppedToPack"), self.slotAddFileToPackage) self.packageCollector = PackageCollector(view, self.connector) self.packageCollector.start() @@ -427,6 +436,12 @@ class main(QObject): self.connector.addFileToPackage(fileid, packid) self.mainWindow.lastAddedID = packid + def slotAddFileToPackage(self, pid, fid): + """ + emitted from collector view after a drop action + """ + self.connector.addFileToPackage(fid, pid) + def slotAddContainer(self, path): """ emitted from main window |