summaryrefslogtreecommitdiffstats
path: root/module/gui/PackageDock.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/gui/PackageDock.py')
-rw-r--r--module/gui/PackageDock.py39
1 files changed, 32 insertions, 7 deletions
diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py
index 8bd965f16..e29c624a2 100644
--- a/module/gui/PackageDock.py
+++ b/module/gui/PackageDock.py
@@ -27,18 +27,38 @@ class NewPackageDock(QDockWidget):
self.setWidget(self.widget)
self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea)
self.hide()
+
+ self.currentPackId = None
+
+ def fillWithPackage(self, packData=None):
+ if not packData:
+ self.widget.nameInput.setText("")
+ self.widget.passwordInput.setText("")
+ self.widget.box.clear()
+ self.currentPackId = None
+ return
+
+ self.widget.box.setPlainText("\n".join(packData["links"]))
+ self.widget.nameInput.setText(packData["name"])
+ self.widget.passwordInput.setText(packData["password"])
+ self.currentPackId = packData["id"]
def slotDone(self):
text = str(self.widget.box.toPlainText())
+ pw = str(self.widget.passwordInput.text())
+ if not pw:
+ pw = None
lines = []
for line in text.splitlines():
line = line.strip()
if not line:
continue
lines.append(line)
- self.emit(SIGNAL("done"), str(self.widget.nameInput.text()), lines)
- self.widget.nameInput.setText("")
- self.widget.box.clear()
+ self.emit(SIGNAL("done"), str(self.widget.nameInput.text()), lines, pw, self.currentPackId)
+ # self.widget.nameInput.setText("")
+ # self.widget.passwordInput.setText("")
+ # self.widget.box.clear()
+ #self.currentPackId = None
self.hide()
class NewPackageWindow(QWidget):
@@ -50,18 +70,23 @@ class NewPackageWindow(QWidget):
nameLabel = QLabel(_("Name"))
nameInput = QLineEdit()
+ passwordLabel = QLabel(_("Password"))
+ passwordInput = QLineEdit()
linksLabel = QLabel(_("Links in this Package"))
self.box = QTextEdit()
self.nameInput = nameInput
+ self.passwordInput = passwordInput
- save = QPushButton(_("Create"))
+ save = QPushButton(_("Save"))
layout.addWidget(nameLabel, 0, 0)
layout.addWidget(nameInput, 0, 1)
- layout.addWidget(linksLabel, 1, 0, 1, 2)
- layout.addWidget(self.box, 2, 0, 1, 2)
- layout.addWidget(save, 3, 0, 1, 2)
+ layout.addWidget(passwordLabel, 1, 0)
+ layout.addWidget(passwordInput, 1, 1)
+ layout.addWidget(linksLabel, 2, 0, 1, 2)
+ layout.addWidget(self.box, 3, 0, 1, 2)
+ layout.addWidget(save, 4, 0, 1, 2)
self.connect(save, SIGNAL("clicked()"), self.dock.slotDone)