diff options
-rw-r--r-- | module/gui/MainWindow.py | 3 | ||||
-rw-r--r-- | module/gui/connector.py | 23 | ||||
-rwxr-xr-x | pyLoadCore.py | 3 | ||||
-rwxr-xr-x | pyLoadGui.py | 5 |
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) |