summaryrefslogtreecommitdiffstats
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
parenthoster plugins: add ifile.it, update share-rapid.com, ifolder.ru (diff)
downloadpyload-59c1d99633dc2a62e8f8b34dc926e4f83eb1babf.tar.xz
royflos GUI patch 2
-rw-r--r--module/gui/MainWindow.py4
-rw-r--r--module/gui/Overview.py19
-rwxr-xr-xpyLoadGui.py24
3 files changed, 14 insertions, 33 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:
diff --git a/pyLoadGui.py b/pyLoadGui.py
index 3a5d62e7b..b8dd6995d 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -171,8 +171,8 @@ class main(QObject):
self.connect(self.mainWindow, SIGNAL("pullOutPackage"), self.slotPullOutPackage)
self.connect(self.mainWindow, SIGNAL("refreshStatus"), self.slotRefreshStatus)
self.connect(self.mainWindow, SIGNAL("reloadAccounts"), self.slotReloadAccounts)
+ self.connect(self.mainWindow, SIGNAL("Quit"), self.slotQuit)
- self.connect(self.mainWindow, SIGNAL("quit"), self.quit)
self.connect(self.mainWindow.mactions["exit"], SIGNAL("triggered()"), self.slotQuit)
self.connect(self.mainWindow.captchaDock, SIGNAL("done"), self.slotCaptchaDone)
@@ -186,11 +186,11 @@ class main(QObject):
self.stopMain()
self.init()
- def quit(self):
- """
- quit gui
- """
- self.app.quit()
+ #def quit(self): #not used anymore?
+ # """
+ # quit gui
+ # """
+ # self.app.quit()
def loop(self):
"""
@@ -472,7 +472,7 @@ class main(QObject):
data = {"password": password}
self.connector.setPackageData(pack, data)
- def slotAddFileToPackage(self, pid, fid): #deprecated?
+ def slotAddFileToPackage(self, pid, fid): #TODO deprecated? gets called
"""
emitted from collector view after a drop action
"""
@@ -511,10 +511,6 @@ class main(QObject):
self.parser.saveData()
- # quit when no tray is avaiable
- if not QSystemTrayIcon.isSystemTrayAvailable():
- self.slotQuit()
-
def restoreMainWindow(self):
"""
load and restore main window geometry and toolbar/dock position from config
@@ -622,12 +618,6 @@ class main(QObject):
"""
self.connector.pullFromQueue(pid)
- def slotSetPriority(self, pid, level):
- """
- set package priority
- """
- self.connector.setPriority(pid, level)
-
def checkCaptcha(self):
if self.connector.isCaptchaWaiting() and self.mainWindow.captchaDock.isFree():
t = self.connector.getCaptchaTask(False)