summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/gui/MainWindow.py13
-rwxr-xr-xpyLoadCore.py3
-rwxr-xr-xpyLoadGui.py24
3 files changed, 31 insertions, 9 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 21227bdf5..d6d6c1eb9 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -57,6 +57,18 @@ class MainWindow(QMainWindow):
lw.setLayout(self.masterlayout)
self.setCentralWidget(lw)
+ #status
+ #@TODO: build a fancy box
+
+ #self.statusw = QFrame()
+ #self.statusw.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)
+ #self.statusw.setLineWidth(2)
+ #self.statusw.setLayout(QGridLayout())
+ #l = self.statusw.layout()
+ #l.addWidget(QLabel("Status:"), 0, 0)
+ #l.addWidget(QLabel("Speed:"), 0, 3)
+ #l.addWidget(QLabel("Space:"), 0, 5)
+
#set menubar and statusbar
self.menubar = self.menuBar()
self.statusbar = self.statusBar()
@@ -110,6 +122,7 @@ class MainWindow(QMainWindow):
#layout
self.masterlayout.addWidget(self.tabw)
+ #self.masterlayout.addWidget(self.statusw)
#signals..
self.connect(self.mactions["manager"], SIGNAL("triggered()"), self.slotShowConnector)
diff --git a/pyLoadCore.py b/pyLoadCore.py
index f792b610a..aad38e11e 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -530,6 +530,9 @@ class ServerMethods():
status['reconnect'] = self.core.config['reconnect']['activated'] and self.is_time_reconnect()
return status
+
+ def free_space(self):
+ return self.core.freeSpace()
def get_server_version(self):
return CURRENT_VERSION
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()