From 20f7c0e65607f2fb8607ed0e5e96181a36be76ca Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 21 Dec 2009 14:24:51 +0100 Subject: new update threads, link dock works now --- module/gui/PackageDock.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 module/gui/PackageDock.py (limited to 'module/gui/PackageDock.py') diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py new file mode 100644 index 000000000..c97e9d645 --- /dev/null +++ b/module/gui/PackageDock.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay +""" + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class NewPackageDock(QDockWidget): + def __init__(self): + QDockWidget.__init__(self, "New Package") + self.widget = NewPackageWindow(self) + self.setWidget(self.widget) + self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea) + self.hide() + +class NewPackageWindow(QWidget): + def __init__(self, dock): + QWidget.__init__(self) + self.dock = dock + self.setLayout(QGridLayout()) + layout = self.layout() + + nameLabel = QLabel("Name") + nameInput = QLineEdit() + + linksLabel = QLabel("Links in this Package") + linkView = QListWidget() + + save = QPushButton("Create") + + layout.addWidget(nameLabel, 0, 0) + layout.addWidget(nameInput, 0, 1) + layout.addWidget(linksLabel, 1, 0, 1, 2) + layout.addWidget(linkView, 2, 0, 1, 2) + layout.addWidget(save, 3, 0, 1, 2) -- cgit v1.2.3 From ff7fa4a0d1aa1c09e563d2086704aa7e2acea716 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 21 Dec 2009 17:07:16 +0100 Subject: package creation works --- module/gui/PackageDock.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'module/gui/PackageDock.py') diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index c97e9d645..7367efda4 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -26,6 +26,18 @@ class NewPackageDock(QDockWidget): 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 +50,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 +71,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) -- cgit v1.2.3 From 59eaacc4228707f715be147350adb0a670de6985 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 21 Dec 2009 17:57:17 +0100 Subject: save window state --- module/gui/PackageDock.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/gui/PackageDock.py') diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index 7367efda4..b90e3533d 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -22,6 +22,7 @@ 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) -- cgit v1.2.3 From da359f8c770bac754234e0f899058b25126cd476 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 28 Dec 2009 19:51:37 +0100 Subject: gui: easier package management --- module/gui/PackageDock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/gui/PackageDock.py') diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index b90e3533d..c81798935 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -53,7 +53,7 @@ class NewPackageWindow(QWidget): linksLabel = QLabel("Links in this Package") linkView = QTreeWidget() linkView.setSelectionBehavior(QAbstractItemView.SelectRows) - linkView.setSelectionMode(QAbstractItemView.SingleSelection) + linkView.setSelectionMode(QAbstractItemView.ExtendedSelection) linkView.setColumnCount(1) linkView.setHeaderLabels(["Name"]) linkView.setDragEnabled(True) -- cgit v1.2.3