diff options
author | mkaay <mkaay@mkaay.de> | 2011-01-27 01:56:58 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-01-27 01:56:58 +0100 |
commit | 7eb04fbfb9287f59da58800e2546ccfddbe1902f (patch) | |
tree | d137b515e4d521185090d287297ed3843a84d758 /module | |
parent | gui overview size calc fix, width issue (diff) | |
download | pyload-7eb04fbfb9287f59da58800e2546ccfddbe1902f.tar.xz |
some improvements
Diffstat (limited to 'module')
-rw-r--r-- | module/gui/MainWindow.py | 1 | ||||
-rw-r--r-- | module/gui/Overview.py | 22 | ||||
-rw-r--r-- | module/gui/Queue.py | 2 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 4 |
4 files changed, 23 insertions, 6 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 9204c7a9b..fc594dd06 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -102,6 +102,7 @@ class MainWindow(QMainWindow): l.addWidget(BoldLabel(_("Space:")), 0, 6) self.space = QLabel("") l.addWidget(self.space, 0, 7) + l.addWidget(BoldLabel(_("Speed:")), 0, 8) self.speed = QLabel("") l.addWidget(self.speed, 0, 9) diff --git a/module/gui/Overview.py b/module/gui/Overview.py index c036875a7..205d85234 100644 --- a/module/gui/Overview.py +++ b/module/gui/Overview.py @@ -30,6 +30,7 @@ class OverviewModel(QAbstractListModel): Speed = 15 CurrentSize = 16 MaxSize = 17 + Status = 18 def __init__(self, view, connector): QAbstractListModel.__init__(self) @@ -51,18 +52,29 @@ class OverviewModel(QAbstractListModel): def maxSize(p): s = 0 for c in p.children: - s += c.data["size"] + try: + s += c.data["downloading"]["size"] + except: + s += c.data["size"] return s + def getProgress(p): + for c in p.children: + if c.data["status"] == 13: + return (_("Unpacking"), int(c.data["progress"])) + return (_("Downloading"), self.queue.getProgress(p)) + d = self.queue._data for p in d: - progress = self.queue.getProgress(p) + status, progress = getProgress(p) maxsize = maxSize(p) speed = self.queue.getSpeed(p) if speed: eta = (maxsize - (maxsize * (progress/100.0)))/1024/speed else: eta = 0 + if not speed and not progress: + status = _("Queued") info = { OverviewModel.PackageName: p.data["name"], OverviewModel.Progress: progress, @@ -72,6 +84,7 @@ class OverviewModel(QAbstractListModel): OverviewModel.Speed: speed, OverviewModel.CurrentSize: int(maxsize * (progress/100.0)), OverviewModel.MaxSize: maxsize, + OverviewModel.Status: status, } self.packages.append(info) @@ -85,7 +98,7 @@ class OverviewModel(QAbstractListModel): return len(self.packages) def data(self, index, role=Qt.DisplayRole): - if role in [OverviewModel.PackageName, OverviewModel.Progress, OverviewModel.PartsFinished, OverviewModel.Parts, OverviewModel.ETA, OverviewModel.Speed, OverviewModel.CurrentSize, OverviewModel.MaxSize]: + if role in [OverviewModel.PackageName, OverviewModel.Progress, OverviewModel.PartsFinished, OverviewModel.Parts, OverviewModel.ETA, OverviewModel.Speed, OverviewModel.CurrentSize, OverviewModel.MaxSize, OverviewModel.Status]: return QVariant(self.packages[index.row()][role]) return QVariant() @@ -119,6 +132,7 @@ class OverviewDelegate(QItemDelegate): progress = int(index.data(OverviewModel.Progress).toString()) currentSize = int(index.data(OverviewModel.CurrentSize).toString()) maxSize = int(index.data(OverviewModel.MaxSize).toString()) + status = index.data(OverviewModel.Status).toString() def formatEta(seconds): if seconds <= 0: return "" @@ -129,6 +143,8 @@ class OverviewDelegate(QItemDelegate): statusline = QString(_("Parts: ") + "%s/%s" % (partsf, parts)) if partsf == parts: speedline = _("Finished") + elif not status == _("Downloading"): + speedline = QString(status) else: speedline = QString(formatEta(eta) + " " + _("Speed: %s kb/s") % speed) diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 4ac68ca31..bcd254fb9 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -145,6 +145,8 @@ class QueueModel(CollectorModel): perc_sum = 0 for child in item.children: try: + if child.data["status"] == 13: #processing + return int(child.data["progress"]) perc_sum += int(child.data["progress"]) except: pass diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index f66a53bdc..e1c24a7f6 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -311,8 +311,6 @@ class Plugin(object): self.pyfile.setStatus("downloading") - self.pyfile.size = 0 - download_folder = self.config['general']['download_folder'] location = save_join(download_folder, self.pyfile.package().folder) @@ -400,4 +398,4 @@ class Plugin(object): if hasattr(self, "thread"): del self.thread if hasattr(self, "html"): - del self.html
\ No newline at end of file + del self.html |