diff options
author | mkaay <mkaay@mkaay.de> | 2010-09-02 20:43:36 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-09-02 20:43:36 +0200 |
commit | af1b74b35dc90af4541b289918335605dac0d9f3 (patch) | |
tree | 6437140c7ef5c3316ab121f232067488278b2263 /pyLoadGui.py | |
parent | gui fix (diff) | |
download | pyload-af1b74b35dc90af4541b289918335605dac0d9f3.tar.xz |
gui: free space display
Diffstat (limited to 'pyLoadGui.py')
-rwxr-xr-x | pyLoadGui.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pyLoadGui.py b/pyLoadGui.py index 870964226..49fd6e067 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -21,7 +21,7 @@ import sys -from time import sleep +from time import sleep, time from PyQt4.QtCore import * from PyQt4.QtGui import * @@ -88,7 +88,9 @@ class main(QObject): default = self.refreshConnections() self.connData = None self.captchaProcessing = False - + self.serverStatus = {"pause":True, "speed":0, "freespace":0} + + if True: self.tray = TrayIcon() self.tray.show() @@ -269,14 +271,14 @@ class main(QObject): """ refresh server status and overall speed in the status bar """ - status = self.connector.getServerStatus() - if status["pause"]: - status["status"] = _("Paused") + self.serverStatus.update(self.connector.getServerStatus()) + if self.serverStatus["pause"]: + self.serverStatus["status"] = _("paused") else: - 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.serverStatus["status"] = _("running") + self.serverStatus["speed"] = int(self.serverStatus["speed"]) + text = _("status: %(status)s | speed: %(speed)s kb/s | free space: %(freespace)s MiB") % self.serverStatus + self.mainWindow.actions["toggle_status"].setChecked(not self.serverStatus["pause"]) self.mainWindow.serverStatus.setText(text) def refreshLog(self): @@ -627,6 +629,7 @@ class main(QObject): self.parent = parent self.timer = QTimer() self.timer.connect(self.timer, SIGNAL("timeout()"), self.update) + self.lastSpaceCheck = 0 def start(self): self.update() @@ -637,6 +640,9 @@ class main(QObject): methods to call """ self.parent.refreshServerStatus() + if self.lastSpaceCheck + 5 < time(): + self.lastSpaceCheck = time() + self.parent.serverStatus["freespace"] = self.parent.connector.proxy.free_space() self.parent.refreshLog() self.parent.checkCaptcha() self.parent.pullEvents() |