summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-21 14:41:23 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-21 14:41:23 +0100
commit4c98db9a0eb0ca1ca70c4886b907e79682bfad82 (patch)
treef4c412ef5e5875b2cbffd1c79bb4a5b2ec4e0892
parentnew update threads, link dock works now (diff)
downloadpyload-4c98db9a0eb0ca1ca70c4886b907e79682bfad82.tar.xz
pause/start button works
-rw-r--r--module/gui/MainWindow.py3
-rw-r--r--module/gui/connector.py23
-rwxr-xr-xpyLoadCore.py3
-rwxr-xr-xpyLoadGui.py5
4 files changed, 32 insertions, 2 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index ccca6b697..6d68f4d7a 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -85,6 +85,7 @@ class MainWindow(QMainWindow):
self.masterlayout.addWidget(self.tabw)
self.connect(self.mactions["manager"], SIGNAL("triggered()"), self.slotShowConnector)
+ self.connect(self.mactions["exit"], SIGNAL("triggered()"), self.close)
def init_toolbar(self):
self.toolbar = self.addToolBar("main")
@@ -134,7 +135,7 @@ class MainWindow(QMainWindow):
self.tabs["collector"]["l"].addWidget(groupLinks, 0, 1)
def slotToggleStatus(self, status):
- print "toggle status", status
+ self.emit(SIGNAL("setDownloadStatus"), status)
def slotStatusStop(self):
print "stop!"
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 3627545ba..32da29bba 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -154,3 +154,26 @@ class connector(QThread):
self.proxy.add_urls(links)
finally:
self.mutex.unlock()
+
+ def togglePause(self):
+ """
+ toogle pause
+ """
+ self.mutex.lock()
+ try:
+ return self.proxy.toggle_pause()
+ finally:
+ self.mutex.unlock()
+
+ def setPause(self, pause):
+ """
+ set pause
+ """
+ self.mutex.lock()
+ try:
+ if pause:
+ self.proxy.pause_server()
+ else:
+ self.proxy.unpause_server()
+ finally:
+ self.mutex.unlock()
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 4df3f852e..9eb385553 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -372,7 +372,8 @@ class ServerMethods():
if self.core.thread_list.pause:
self.core.thread_list.pause = False
else:
- self.core.thread_list.pause = True
+ self.core.thread_list.pause = True
+ return self.core.thread_list.pause
def status_server(self):
status = {}
diff --git a/pyLoadGui.py b/pyLoadGui.py
index 2afd63033..6c3bae1dd 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -88,6 +88,7 @@ class main(QObject):
self.connect(self.pwWindow, SIGNAL("cancel"), self.quit)
self.connect(self.mainWindow, SIGNAL("connector"), self.slotShowConnector)
self.connect(self.mainWindow, SIGNAL("addLinks"), self.slotAddLinks)
+ self.connect(self.mainWindow, SIGNAL("setDownloadStatus"), self.slotSetDownloadStatus)
def slotShowConnector(self):
self.stopMain()
@@ -142,6 +143,7 @@ class main(QObject):
status["status"] = "Running"
status["speed"] = int(status["speed"])
text = "Status: %(status)s | Speed: %(speed)s kb/s" % status
+ self.mainWindow.actions["toggle_status"].setChecked(not status["pause"])
self.mainWindow.serverStatus.setText(text)
def getConnections(self):
@@ -269,6 +271,9 @@ class main(QObject):
def slotAddLinks(self, links):
self.connector.addURLs(links)
+ def slotSetDownloadStatus(self, status):
+ self.connector.setPause(not status)
+
class Loop(QThread):
def __init__(self, parent):
QThread.__init__(self)