diff options
author | mkaay <mkaay@mkaay.de> | 2009-12-28 19:51:37 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2009-12-28 19:51:37 +0100 |
commit | da359f8c770bac754234e0f899058b25126cd476 (patch) | |
tree | d519267334d9526f21a3cf39c86d5f8ba916ce7a /pyLoadGui.py | |
parent | Fixed DLC (diff) | |
download | pyload-da359f8c770bac754234e0f899058b25126cd476.tar.xz |
gui: easier package management
Diffstat (limited to 'pyLoadGui.py')
-rwxr-xr-x | pyLoadGui.py | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/pyLoadGui.py b/pyLoadGui.py index 681feec8a..5ce098fa0 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -154,39 +154,53 @@ class main(QObject): * columns * selection * refresh thread - """ - view = self.mainWindow.tabs["collector"]["package_view"] - view.setColumnCount(1) - view.setHeaderLabels(["Name"]) - view.setSelectionMode(QAbstractItemView.ExtendedSelection) - self.packageCollector = PackageCollector(view, self.connector) - self.packageCollector.start() - - def initLinkCollector(self): - """ - init the link collector view - * columns - * selection * drag'n'drop - * refresh thread """ - view = self.mainWindow.tabs["collector"]["link_view"] + view = self.mainWindow.tabs["collector"]["package_view"] view.setColumnCount(1) view.setHeaderLabels(["Name"]) view.setSelectionBehavior(QAbstractItemView.SelectRows) - view.setSelectionMode(QAbstractItemView.SingleSelection) - def event(klass, event): + view.setSelectionMode(QAbstractItemView.ExtendedSelection) + def dropEvent(klass, event): event.setDropAction(Qt.CopyAction) event.accept() view = event.source() - row = view.currentIndex().row() - view.takeTopLevelItem(row) - view.dropEvent = event + if view == klass: + event.ignore() + return + items = view.selectedItems() + for item in items: + row = view.indexOfTopLevelItem(item) + view.takeTopLevelItem(row) + def dragEvent(klass, event): + view = event.source() + dragOkay = False + items = view.selectedItems() + for item in items: + if hasattr(item, "_data"): + if item._data["id"] == "fixed" or item.parent()._data["id"] == "fixed": + dragOkay = True + else: + dragOkay = True + if dragOkay: + event.accept() + else: + event.ignore() + view.dropEvent = dropEvent + view.dragEnterEvent = dragEvent view.setDragEnabled(True) view.setDragDropMode(QAbstractItemView.DragDrop) view.setDropIndicatorShown(True) view.setDragDropOverwriteMode(True) - self.linkCollector = LinkCollector(view, self.connector) + self.packageCollector = PackageCollector(view, self.connector) + self.packageCollector.start() + + def initLinkCollector(self): + """ + init the link collector + * refresh thread + """ + self.linkCollector = LinkCollector(self.mainWindow.tabs["collector"]["package_view"], self.packageCollector.linkCollector, self.connector) self.linkCollector.start() def initQueue(self): @@ -411,6 +425,7 @@ class main(QObject): packid = self.connector.newPackage(str(name)) for fileid in ids: self.connector.addFileToPackage(fileid, packid) + self.mainWindow.lastAddedID = packid def slotAddContainer(self, path): """ |