summaryrefslogtreecommitdiffstats
path: root/module/gui/PackageDock.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-21 18:52:51 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-21 18:52:51 +0100
commit9a435f166b8d70fa2e61351b1d84db77c5b42472 (patch)
tree0b0fc9193e8666721b880351d9a5a5ac31f78cb8 /module/gui/PackageDock.py
parenttotal progressbar bullshit (diff)
parentmerged Wugy (diff)
downloadpyload-9a435f166b8d70fa2e61351b1d84db77c5b42472.tar.xz
merged Wugy, 2nd try
Diffstat (limited to 'module/gui/PackageDock.py')
-rw-r--r--module/gui/PackageDock.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py
index c97e9d645..b90e3533d 100644
--- a/module/gui/PackageDock.py
+++ b/module/gui/PackageDock.py
@@ -22,10 +22,23 @@ from PyQt4.QtGui import *
class NewPackageDock(QDockWidget):
def __init__(self):
QDockWidget.__init__(self, "New Package")
+ self.setObjectName("New Package Dock")
self.widget = NewPackageWindow(self)
self.setWidget(self.widget)
self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea)
self.hide()
+
+ def slotDone(self):
+ view = self.widget.view
+ count = view.topLevelItemCount()
+ ids = []
+ for i in range(count):
+ item = view.topLevelItem(i)
+ if item:
+ ids.append(item.data(0, Qt.UserRole).toInt()[0])
+ self.emit(SIGNAL("done"), self.widget.nameInput.text(), ids)
+ view.clear()
+ self.hide()
class NewPackageWindow(QWidget):
def __init__(self, dock):
@@ -38,7 +51,19 @@ class NewPackageWindow(QWidget):
nameInput = QLineEdit()
linksLabel = QLabel("Links in this Package")
- linkView = QListWidget()
+ linkView = QTreeWidget()
+ linkView.setSelectionBehavior(QAbstractItemView.SelectRows)
+ linkView.setSelectionMode(QAbstractItemView.SingleSelection)
+ linkView.setColumnCount(1)
+ linkView.setHeaderLabels(["Name"])
+ linkView.setDragEnabled(True)
+ linkView.setDragDropMode(QAbstractItemView.DragDrop)
+ linkView.setDropIndicatorShown(True)
+ linkView.setAcceptDrops(True)
+ linkView.setDragDropOverwriteMode(True)
+
+ self.view = linkView
+ self.nameInput = nameInput
save = QPushButton("Create")
@@ -47,3 +72,5 @@ class NewPackageWindow(QWidget):
layout.addWidget(linksLabel, 1, 0, 1, 2)
layout.addWidget(linkView, 2, 0, 1, 2)
layout.addWidget(save, 3, 0, 1, 2)
+
+ self.connect(save, SIGNAL("clicked()"), self.dock.slotDone)