summaryrefslogtreecommitdiffstats
path: root/module/gui
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-23 00:04:36 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-23 00:04:36 +0100
commita5ff0482ede8bd7bd932482887f2f7cdae5039d9 (patch)
tree0d59800acd09c72ddb9c1e360d6a9c065cf184b7 /module/gui
parentmore docstrings, small design changes (diff)
downloadpyload-a5ff0482ede8bd7bd932482887f2f7cdae5039d9.tar.xz
core: downloadlimit is not far away ;) gui: restart download action
Diffstat (limited to 'module/gui')
-rw-r--r--module/gui/MainWindow.py19
-rw-r--r--module/gui/connector.py20
2 files changed, 37 insertions, 2 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index f72ad97de..837125263 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -153,6 +153,9 @@ class MainWindow(QMainWindow):
self.tabs["collector"]["l"].addWidget(groupPackage, 0, 0)
self.tabs["collector"]["l"].addWidget(groupLinks, 0, 1)
self.connect(toQueue, SIGNAL("clicked()"), self.slotPushPackageToQueue)
+ self.tabs["collector"]["package_view"].setContextMenuPolicy(Qt.CustomContextMenu)
+ self.tabs["collector"]["link_view"].setContextMenuPolicy(Qt.CustomContextMenu)
+ self.tabs["queue"]["view"].setContextMenuPolicy(Qt.CustomContextMenu)
def init_context(self):
"""
@@ -160,8 +163,12 @@ class MainWindow(QMainWindow):
"""
self.queueContext = QMenu()
self.queueContext.buttons = {}
+ self.queueContext.item = (None, None)
self.queueContext.buttons["remove"] = QAction("Remove", self.queueContext)
+ self.queueContext.buttons["restart"] = QAction("Restart", self.queueContext)
self.queueContext.addAction(self.queueContext.buttons["remove"])
+ self.queueContext.addAction(self.queueContext.buttons["restart"])
+ self.connect(self.queueContext.buttons["restart"], SIGNAL("triggered()"), self.slotRestartDownload)
def slotToggleStatus(self, status):
"""
@@ -273,8 +280,8 @@ class MainWindow(QMainWindow):
globalPos = self.tabs["queue"]["view"].mapToGlobal(pos)
i = self.tabs["queue"]["view"].itemAt(pos)
i.setSelected(True)
- self.addFav.setData(QVariant(i))
- self.showContext.exec_(globalPos)
+ self.queueContext.item = (i.data(0, Qt.UserRole).toPyObject(), i.parent() == None)
+ self.queueContext.exec_(globalPos)
def slotPackageCollectorContextMenu(self, pos):
"""
@@ -287,4 +294,12 @@ class MainWindow(QMainWindow):
custom context menu in link collector view requested
"""
pass
+
+ def slotRestartDownload(self):
+ """
+ restart download action is triggered
+ """
+ id, isTopLevel = self.queueContext.item
+ if not id == None:
+ self.emit(SIGNAL("restartDownload"), id, isTopLevel)
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 2a1ce511e..75781ebb1 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -210,3 +210,23 @@ class connector(QThread):
self.proxy.push_package_2_queue(packid)
finally:
self.mutex.unlock()
+
+ def restartPackage(self, packid):
+ """
+ restart a package
+ """
+ self.mutex.lock()
+ try:
+ self.proxy.restart_package(packid)
+ finally:
+ self.mutex.unlock()
+
+ def restartFile(self, fileid):
+ """
+ restart a file
+ """
+ self.mutex.lock()
+ try:
+ self.proxy.restart_file(fileid)
+ finally:
+ self.mutex.unlock()