summaryrefslogtreecommitdiffstats
path: root/module/gui
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-30 18:28:58 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-30 18:28:58 +0200
commit59c1d99633dc2a62e8f8b34dc926e4f83eb1babf (patch)
tree3392a1ad09ea2d5a042e836fd4bbcad855325e82 /module/gui
parenthoster plugins: add ifile.it, update share-rapid.com, ifolder.ru (diff)
downloadpyload-59c1d99633dc2a62e8f8b34dc926e4f83eb1babf.tar.xz
royflos GUI patch 2
Diffstat (limited to 'module/gui')
-rw-r--r--module/gui/MainWindow.py4
-rw-r--r--module/gui/Overview.py19
2 files changed, 7 insertions, 16 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 9aea50b33..1195a4436 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -445,6 +445,10 @@ class MainWindow(QMainWindow):
event.ignore()
self.hide()
self.emit(SIGNAL("hidden"))
+
+ # quit when no tray is available
+ if not QSystemTrayIcon.isSystemTrayAvailable():
+ self.emit(SIGNAL("Quit"))
def restoreWindow(self, state, geo):
"""
diff --git a/module/gui/Overview.py b/module/gui/Overview.py
index ee05d92e9..183383b5e 100644
--- a/module/gui/Overview.py
+++ b/module/gui/Overview.py
@@ -19,8 +19,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
-
-from module.utils import formatSpeed
+from module.utils import formatSpeed, formatSize
class OverviewModel(QAbstractListModel):
PackageName = 10
@@ -68,7 +67,7 @@ class OverviewModel(QAbstractListModel):
def getProgress(p):
for c in p.children:
if c.data["status"] == 13:
- return _("Unpacking"), int(c.data["progress"])
+ pass # TODO return _("Unpacking"), int(c.data["progress"])
return _("Downloading"), self.queue.getProgress(p)
d = self.queue._data
@@ -141,7 +140,7 @@ class OverviewDelegate(QItemDelegate):
maxSize = int(index.data(OverviewModel.MaxSize).toString())
status = index.data(OverviewModel.Status).toString()
- def formatEta(seconds):
+ def formatEta(seconds): #TODO add to utils
if seconds <= 0: return ""
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmod(seconds, 60)
@@ -155,18 +154,6 @@ class OverviewDelegate(QItemDelegate):
else:
speedline = QString(formatEta(eta) + " " + _("Speed: %s") % formatSpeed(speed))
- def formatSize(size):
- from math import ceil
- kbytes = size/1024
- if kbytes >= 1024:
- if kbytes/1024 >= 1024:
- size = "%s GiB" % round(float(ceil(kbytes))/1024/1024, 2)
- else:
- size = "%s MiB" % round(float(ceil(kbytes))/1024, 2)
- else:
- size = "%s KiB" % kbytes
- return size
-
if progress in (0,100):
sizeline = QString(_("Size:") + "%s" % formatSize(maxSize))
else: