summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-11-19 14:15:17 +0100
committerGravatar Jeix <devnull@localhost> 2010-11-19 14:15:17 +0100
commitc881b83f107e3c5b28bfcc06508d4db128d37e20 (patch)
treefd3a463b0f5bf3ee45fdfa30db4270609c78dbf3
parentclosed #153 (diff)
downloadpyload-c881b83f107e3c5b28bfcc06508d4db128d37e20.tar.xz
sharecx fix and gui package edit
-rw-r--r--module/gui/MainWindow.py27
-rw-r--r--module/gui/PackageDock.py39
-rw-r--r--module/gui/connector.py2
-rw-r--r--module/plugins/hoster/ShareCx.py2
-rwxr-xr-xpyLoadGui.py12
5 files changed, 64 insertions, 18 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 03590ac2d..60b6e2033 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -259,7 +259,7 @@ class MainWindow(QMainWindow):
self.collectorContext.item = (None, None)
self.collectorContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons","remove_small.png")), _("Remove"), self.collectorContext)
self.collectorContext.buttons["push"] = QAction(QIcon(join(pypath, "icons","push_small.png")), _("Push to queue"), self.collectorContext)
- self.collectorContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit Name"), self.collectorContext)
+ self.collectorContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit"), self.collectorContext)
self.collectorContext.buttons["restart"] = QAction(QIcon(join(pypath, "icons","refresh_small.png")), _("Restart"), self.collectorContext)
self.collectorContext.buttons["refresh"] = QAction(QIcon(join(pypath, "icons","refresh1_small.png")),_("Refresh Status"), self.collectorContext)
self.collectorContext.addAction(self.collectorContext.buttons["push"])
@@ -317,6 +317,7 @@ class MainWindow(QMainWindow):
show new-package dock
"""
self.tabw.setCurrentIndex(1)
+ self.newPackDock.fillWithPackage(None)
self.newPackDock.show()
def slotShowAddLinks(self):
@@ -334,12 +335,12 @@ class MainWindow(QMainWindow):
"""
self.emit(SIGNAL("connector"))
- def slotAddPackage(self, name, links):
+ def slotAddPackage(self, name, links, password=None, id=None):
"""
new package
let main to the stuff
"""
- self.emit(SIGNAL("addPackage"), name, links)
+ self.emit(SIGNAL("addPackage"), name, links, password, id)
def slotShowAddContainer(self):
"""
@@ -508,11 +509,25 @@ class MainWindow(QMainWindow):
self.emit(SIGNAL("setClipboardStatus"), status)
def slotEditPackage(self):
+ # in Queue, only edit name
if self.activeMenu == self.queueContext:
view = self.tabs["queue"]["view"]
- else:
- view = self.tabs["collector"]["package_view"]
- view.edit(self.activeMenu.index)
+ view.edit(self.activeMenu.index)
+ return
+
+ # in collector, edit entire package, this requires deleting the old one
+ # and creating a new one, all progress will be lost
+ pId = self.activeMenu.index.internalPointer().id
+
+ packData = self.connector.getPackageInfo(pId)
+ packData["id"] = pId
+ links = []
+ for fId in packData["links"]:
+ links.append( self.connector.getLinkInfo(fId)[fId]["url"] )
+ packData["links"] = links
+
+ self.newPackDock.fillWithPackage(packData)
+ self.newPackDock.show()
def slotEditCommit(self, editor):
self.emit(SIGNAL("changePackageName"), self.activeMenu.index.internalPointer().id, editor.text())
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)
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 485578bbe..8417b888e 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -119,7 +119,7 @@ class Connector(QThread):
"""
grab file info for the given id and return it
"""
- w = self.proxy.get_file_info
+ w = self.proxy.get_file_data
w.error = False
info = w(id)
if not info: return None
diff --git a/module/plugins/hoster/ShareCx.py b/module/plugins/hoster/ShareCx.py
index 2615c6e11..38c557193 100644
--- a/module/plugins/hoster/ShareCx.py
+++ b/module/plugins/hoster/ShareCx.py
@@ -138,7 +138,7 @@ class ShareCx(Hoster):
if self.html is None:
self.download_html()
- name = re.search(r'alt="Download" /></span>(.*?)</h3>', self.html).group(1)
+ name = re.search(r'<title>Download: (.*?)</title>', self.html).group(1)
return name
def file_exists(self):
diff --git a/pyLoadGui.py b/pyLoadGui.py
index c52a86052..441b01caa 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -21,7 +21,7 @@
import sys
-from uuid import uuid4 as uuid
+from uuid import uuid4 as uuid # should be above PyQt imports
from time import sleep, time
from PyQt4.QtCore import *
@@ -464,12 +464,18 @@ class main(QObject):
"""
self.connector.setPause(not status)
- def slotAddPackage(self, name, links):
+ def slotAddPackage(self, name, links, password=None, id=None):
"""
emitted from main window
add package to the collector
"""
- self.connector.proxy.add_package(name, links)
+ if id:
+ self.connector.removePackage(id)
+
+ pack = self.connector.proxy.add_package(name, links)
+ if password:
+ data = {"password": password}
+ self.connector.proxy.set_package_data(pack, data)
def slotAddFileToPackage(self, pid, fid):
"""