diff options
author | Jeix <devnull@localhost> | 2010-11-19 16:04:43 +0100 |
---|---|---|
committer | Jeix <devnull@localhost> | 2010-11-19 16:04:43 +0100 |
commit | e7ed9d55d271005a9d10a73c414e12f07cee1616 (patch) | |
tree | 15ec3e45643d128cf72847d827794e9b0eeb0bc1 /module | |
parent | add_files rpc method (diff) | |
download | pyload-e7ed9d55d271005a9d10a73c414e12f07cee1616.tar.xz |
megaupload pw protected files, GUI fixes
Diffstat (limited to 'module')
-rw-r--r-- | module/gui/MainWindow.py | 45 | ||||
-rw-r--r-- | module/gui/PackageDock.py | 26 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 4 |
3 files changed, 31 insertions, 44 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 60b6e2033..95d8787ad 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"), self.collectorContext) + self.collectorContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit Name"), 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"]) @@ -272,6 +272,7 @@ class MainWindow(QMainWindow): self.collectorContext.addAction(self.collectorContext.buttons["refresh"]) packageAction = self.collectorContext.buttons["add"].addAction(_("Package")) containerAction = self.collectorContext.buttons["add"].addAction(_("Container")) + linkAction = self.collectorContext.buttons["add"].addAction(_("Links")) self.connect(self.collectorContext.buttons["remove"], SIGNAL("triggered()"), self.slotRemoveDownload) self.connect(self.collectorContext.buttons["push"], SIGNAL("triggered()"), self.slotPushPackageToQueue) self.connect(self.collectorContext.buttons["edit"], SIGNAL("triggered()"), self.slotEditPackage) @@ -279,6 +280,7 @@ class MainWindow(QMainWindow): self.connect(self.collectorContext.buttons["refresh"], SIGNAL("triggered()"), self.slotRefreshPackage) self.connect(packageAction, SIGNAL("triggered()"), self.slotShowAddPackage) self.connect(containerAction, SIGNAL("triggered()"), self.slotShowAddContainer) + self.connect(linkAction, SIGNAL("triggered()"), self.slotShowAddLinks) self.accountContext = QMenu() self.accountContext.buttons = {} @@ -317,7 +319,6 @@ class MainWindow(QMainWindow): show new-package dock """ self.tabw.setCurrentIndex(1) - self.newPackDock.fillWithPackage(None) self.newPackDock.show() def slotShowAddLinks(self): @@ -325,8 +326,9 @@ class MainWindow(QMainWindow): action from add-menu show new-links dock """ - self.tabw.setCurrentIndex(1) - self.newLinkDock.show() + pass + #self.tabw.setCurrentIndex(1) + #self.newLinkDock.show() def slotShowConnector(self): """ @@ -335,12 +337,12 @@ class MainWindow(QMainWindow): """ self.emit(SIGNAL("connector")) - def slotAddPackage(self, name, links, password=None, id=None): + def slotAddPackage(self, name, links, password=None): """ new package let main to the stuff """ - self.emit(SIGNAL("addPackage"), name, links, password, id) + self.emit(SIGNAL("addPackage"), name, links, password) def slotShowAddContainer(self): """ @@ -439,6 +441,12 @@ class MainWindow(QMainWindow): self.queueContext.buttons["pull"].setEnabled(True) self.queueContext.buttons["edit"].setEnabled(True) self.queuePriorityMenu.setEnabled(True) + elif isinstance(item, Link): + self.collectorContext.index = i + self.collectorContext.buttons["edit"].setEnabled(False) + self.collectorContext.buttons["remove"].setEnabled(True) + self.collectorContext.buttons["push"].setEnabled(False) + self.collectorContext.buttons["restart"].setEnabled(True) else: self.queueContext.index = None self.queueContext.buttons["remove"].setEnabled(False) @@ -466,6 +474,12 @@ class MainWindow(QMainWindow): self.collectorContext.buttons["remove"].setEnabled(True) self.collectorContext.buttons["push"].setEnabled(True) self.collectorContext.buttons["restart"].setEnabled(True) + elif isinstance(item, Link): + self.collectorContext.index = i + self.collectorContext.buttons["edit"].setEnabled(False) + self.collectorContext.buttons["remove"].setEnabled(True) + self.collectorContext.buttons["push"].setEnabled(False) + self.collectorContext.buttons["restart"].setEnabled(True) else: self.collectorContext.index = None self.collectorContext.buttons["edit"].setEnabled(False) @@ -512,23 +526,10 @@ class MainWindow(QMainWindow): # in Queue, only edit name if self.activeMenu == self.queueContext: view = self.tabs["queue"]["view"] - view.edit(self.activeMenu.index) - return + else: + view = self.tabs["collector"]["package_view"] + view.edit(self.activeMenu.index) - # 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 e29c624a2..077abb44c 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -27,21 +27,6 @@ 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()) @@ -54,11 +39,10 @@ class NewPackageDock(QDockWidget): if not line: continue lines.append(line) - 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.emit(SIGNAL("done"), str(self.widget.nameInput.text()), lines, pw) + self.widget.nameInput.setText("") + self.widget.passwordInput.setText("") + self.widget.box.clear() self.hide() class NewPackageWindow(QWidget): @@ -79,7 +63,7 @@ class NewPackageWindow(QWidget): self.nameInput = nameInput self.passwordInput = passwordInput - save = QPushButton(_("Save")) + save = QPushButton(_("Create")) layout.addWidget(nameLabel, 0, 0) layout.addWidget(nameInput, 0, 1) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index a16369784..45711191e 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -108,7 +108,9 @@ class MegauploadCom(Hoster): self.fail(_("You need premium to download files larger than 1 GB")) if r'Please enter the password below to proceed' in self.html[0]: - self.fail(_("The file is password protected")) + pw = self.pyfile.package().password + self.html[1] = self.load(self.pyfile.url, post={"filepassword":pw}) + break # looks like there is no captcha for pw protected files while "document.location='http://www.megaupload.com/?c=msg" in self.html[0]: # megaupload.com/?c=msg usually says: Please check back in 2 minutes, |