diff options
-rw-r--r-- | module/FileDatabase.py | 3 | ||||
-rw-r--r-- | module/gui/LinkDock.py | 2 | ||||
-rw-r--r-- | module/gui/MainWindow.py | 25 | ||||
-rwxr-xr-x | pyLoadCore.py | 5 |
4 files changed, 26 insertions, 9 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index cdb939529..9225873fe 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -168,7 +168,8 @@ class FileHandler: self.db.addLinks(data, package) self.core.threadManager.createInfoThread(data, package) - #@TODO package update event + #@TODO change from reloadAll event to package update event + self.core.pullManager.addEvent(ReloadAllEvent("collector")) #---------------------------------------------------------------------- @lock diff --git a/module/gui/LinkDock.py b/module/gui/LinkDock.py index 99429d04b..ac2d4aae5 100644 --- a/module/gui/LinkDock.py +++ b/module/gui/LinkDock.py @@ -42,11 +42,13 @@ class NewLinkWindow(QWidget): self.setLayout(QVBoxLayout()) layout = self.layout() + explanationLabel = QLabel("Select a package and then click Add button.") boxLabel = QLabel("Paste URLs here:") self.box = QTextEdit() save = QPushButton("Add") + layout.addWidget(explanationLabel) layout.addWidget(boxLabel) layout.addWidget(self.box) layout.addWidget(save) diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 95d8787ad..103dd8d7a 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -51,6 +51,9 @@ class MainWindow(QMainWindow): self.connect(self.newPackDock, SIGNAL("done"), self.slotAddPackage) self.captchaDock = CaptchaDock() self.addDockWidget(Qt.BottomDockWidgetArea, self.captchaDock) + self.newLinkDock = NewLinkDock() + self.addDockWidget(Qt.RightDockWidgetArea, self.newLinkDock) + self.connect(self.newLinkDock, SIGNAL("done"), self.slotAddLinksToPackage) #central widget, layout self.masterlayout = QVBoxLayout() @@ -165,10 +168,12 @@ class MainWindow(QMainWindow): packageAction = self.addMenu.addAction(_("Package")) containerAction = self.addMenu.addAction(_("Container")) accountAction = self.addMenu.addAction(_("Account")) + linksAction = self.addMenu.addAction(_("Links")) self.connect(self.actions["add"], SIGNAL("triggered()"), self.slotAdd) self.connect(packageAction, SIGNAL("triggered()"), self.slotShowAddPackage) self.connect(containerAction, SIGNAL("triggered()"), self.slotShowAddContainer) self.connect(accountAction, SIGNAL("triggered()"), self.slotNewAccount) + self.connect(linksAction, SIGNAL("triggered()"), self.slotShowAddLinks) def init_tabs(self, connector): """ @@ -326,9 +331,8 @@ class MainWindow(QMainWindow): action from add-menu show new-links dock """ - pass - #self.tabw.setCurrentIndex(1) - #self.newLinkDock.show() + self.tabw.setCurrentIndex(1) + self.newLinkDock.show() def slotShowConnector(self): """ @@ -343,6 +347,21 @@ class MainWindow(QMainWindow): let main to the stuff """ self.emit(SIGNAL("addPackage"), name, links, password) + + def slotAddLinksToPackage(self, links): + """ + adds links to currently selected package + only in collector + """ + if self.tabw.currentIndex() != 1: + return + + smodel = self.tabs["collector"]["package_view"].selectionModel() + for index in smodel.selectedRows(0): + item = index.internalPointer() + if isinstance(item, Package): + self.connector.proxy.add_files(item.id, links) + break def slotShowAddContainer(self): """ diff --git a/pyLoadCore.py b/pyLoadCore.py index 01be0e185..a926b876d 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -66,7 +66,6 @@ from module.FileDatabase import PyFile from module.Scheduler import Scheduler from module.JsEngine import JsEngine -from module.PullEvents import UpdateEvent from codecs import getwriter if os.name == "nt": @@ -713,15 +712,11 @@ class ServerMethods(): def add_files(self, pid, links): pid = int(pid) - p = self.core.files.getPackage() self.core.files.addLinks(links, pid) self.core.log.info(_("Added %(count)d links to package #%(package)d ") % {"count": len(links), "package": pid}) self.core.files.save() - e = UpdateEvent("pack", pid, "collector" if not p.queue else "queue") - self.core.pullManager.addEvent(e) - return pid def push_package_to_queue(self, id): |