summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2011-02-12 01:55:39 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2011-02-12 01:55:39 +0100
commit27d8fe970c2102edb3fc5bc333b05f975e5ae2d3 (patch)
tree092600f0fb2c44fde8d0d5324a8beb28249cad70 /module
parentgui freze fix, closes #240, sslxmlrpc fix? (diff)
downloadpyload-27d8fe970c2102edb3fc5bc333b05f975e5ae2d3.tar.xz
gui optimisations
Diffstat (limited to 'module')
-rw-r--r--module/gui/MainWindow.py2
-rw-r--r--module/gui/Overview.py18
-rw-r--r--module/gui/Queue.py15
-rw-r--r--module/remote/thriftbackend/ThriftTest.py18
4 files changed, 34 insertions, 19 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index fc594dd06..b5ec345cb 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -41,7 +41,7 @@ class MainWindow(QMainWindow):
#window stuff
self.setWindowTitle(_("pyLoad Client"))
self.setWindowIcon(QIcon(join(pypath, "icons","logo.png")))
- self.resize(900,500)
+ self.resize(1000,600)
#layout version
self.version = 3
diff --git a/module/gui/Overview.py b/module/gui/Overview.py
index 533c6faa8..1ac790515 100644
--- a/module/gui/Overview.py
+++ b/module/gui/Overview.py
@@ -50,13 +50,19 @@ class OverviewModel(QAbstractListModel):
return f
def maxSize(p):
- s = 0
+ ms = 0
+ cs = 0
for c in p.children:
try:
- s += c.data["downloading"]["size"]
+ s = c.data["downloading"]["size"]
except:
- s += c.data["size"]
- return s
+ s = c.data["size"]
+ if c.data["downloading"]:
+ cs += s - c.data["downloading"]["bleft"]
+ elif self.queue.getProgress(c, False) == 100:
+ cs += s
+ ms += s
+ return ms, cs
def getProgress(p):
for c in p.children:
@@ -67,7 +73,7 @@ class OverviewModel(QAbstractListModel):
d = self.queue._data
for p in d:
status, progress = getProgress(p)
- maxsize = maxSize(p)
+ maxsize, currentsize = maxSize(p)
speed = self.queue.getSpeed(p)
if speed:
eta = (maxsize - (maxsize * (progress/100.0)))/1024/speed
@@ -82,7 +88,7 @@ class OverviewModel(QAbstractListModel):
OverviewModel.Parts: len(p.children),
OverviewModel.ETA: int(eta),
OverviewModel.Speed: speed,
- OverviewModel.CurrentSize: int(maxsize * (progress/100.0)),
+ OverviewModel.CurrentSize: currentsize,
OverviewModel.MaxSize: maxsize,
OverviewModel.Status: status,
}
diff --git a/module/gui/Queue.py b/module/gui/Queue.py
index c1944eb54..d2541f024 100644
--- a/module/gui/Queue.py
+++ b/module/gui/Queue.py
@@ -27,7 +27,7 @@ def formatSize(size):
"""formats size of bytes"""
size = int(size)
steps = 0
- sizes = ["B", "KB", "MB", "GB", "TB"]
+ sizes = ["B", "KiB", "MiB", "GiB", "TiB"]
while size > 1000:
size /= 1024.0
@@ -222,18 +222,23 @@ class QueueModel(CollectorModel):
if speed is None or status == 7 or status == 10 or status == 5:
return QVariant(self.translateStatus(statusMapReverse[status]))
else:
- return QVariant("%s (%s KB/s)" % (self.translateStatus(statusMapReverse[status]), speed))
+ return QVariant("%s (%s KiB/s)" % (self.translateStatus(statusMapReverse[status]), speed))
elif index.column() == 3:
item = index.internalPointer()
if isinstance(item, Package):
return QVariant(item.data["priority"])
+ else:
+ return QVariant(item.package.data["priority"])
elif index.column() == 4:
item = index.internalPointer()
if isinstance(item, Link):
if self.getProgress(item, False) == 100:
return QVariant(formatSize(item.data["size"]))
elif self.getProgress(item, False) == 0:
- return QVariant("0 B / %s" % formatSize(item.data["size"]))
+ try:
+ return QVariant("%s / %s" % (formatSize(item.data["size"]-item.data["downloading"]["bleft"]), formatSize(item.data["size"])))
+ except:
+ return QVariant("0 B / %s" % formatSize(item.data["size"]))
else:
try:
return QVariant("%s / %s" % (formatSize(item.data["size"]-item.data["downloading"]["bleft"]), formatSize(item.data["size"])))
@@ -278,9 +283,9 @@ class QueueView(CollectorView):
self.setColumnWidth(0, 300)
self.setColumnWidth(1, 100)
- self.setColumnWidth(2, 120)
+ self.setColumnWidth(2, 130)
self.setColumnWidth(3, 50)
- self.setColumnWidth(4, 100)
+ self.setColumnWidth(4, 120)
self.setColumnWidth(5, 70)
self.setEditTriggers(QAbstractItemView.NoEditTriggers)
diff --git a/module/remote/thriftbackend/ThriftTest.py b/module/remote/thriftbackend/ThriftTest.py
index 8cfeb68d5..69ac6a745 100644
--- a/module/remote/thriftbackend/ThriftTest.py
+++ b/module/remote/thriftbackend/ThriftTest.py
@@ -30,10 +30,14 @@ def bench(f, *args, **kwargs):
print "%s: %f s" % (f.__name__, e-s)
return ret
+from getpass import getpass
+user = raw_input("user ")
+passwd = getpass("password ")
+
server_url = "http%s://%s:%s@%s:%s/" % (
"",
- "user",
- "password",
+ user,
+ passwd,
"127.0.0.1",
7227
)
@@ -42,8 +46,8 @@ proxy = xmlrpclib.ServerProxy(server_url, allow_none=True)
bench(proxy.get_server_version)
bench(proxy.status_server)
bench(proxy.status_downloads)
-bench(proxy.get_queue)
-bench(proxy.get_collector)
+#bench(proxy.get_queue)
+#bench(proxy.get_collector)
print
try:
@@ -62,13 +66,13 @@ try:
# Connect!
transport.open()
- print "Login", client.login("User", "pyloadweb")
+ print "Login", client.login(user, passwd)
bench(client.getServerVersion)
bench(client.statusServer)
bench(client.statusDownloads)
- bench(client.getQueue)
- bench(client.getCollector)
+ #bench(client.getQueue)
+ #bench(client.getCollector)
print
print client.getServerVersion()