Merge lp:~osomon/software-center/download_completion into lp:software-center

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: not available
Proposed branch: lp:~osomon/software-center/download_completion
Merge into: lp:software-center
Diff against target: 61 lines (+15/-4)
1 file modified
softwarecenter/view/pendingview.py (+15/-4)
To merge this branch: bzr merge lp:~osomon/software-center/download_completion
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+23836@code.launchpad.net

Description of the change

This branch implements the display of the download completion as requested in bug #460888 and designed in the specification (https://wiki.ubuntu.com/SoftwareCenter#in-progress).

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Looks good, many thanks! Unfortunately its a string addition so I can't merge it into the lucid branch.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/view/pendingview.py'
2--- softwarecenter/view/pendingview.py 2010-04-20 11:55:41 +0000
3+++ softwarecenter/view/pendingview.py 2010-04-21 09:02:14 +0000
4@@ -21,6 +21,7 @@
5 import gtk
6 import gobject
7 import apt
8+import apt_pkg
9 import os
10 import sys
11
12@@ -30,6 +31,8 @@
13 from softwarecenter.enums import *
14 from softwarecenter.backend.transactionswatcher import TransactionsWatcher
15
16+from gettext import gettext as _
17+
18 class PendingStore(gtk.ListStore, TransactionsWatcher):
19
20 # column names
21@@ -107,7 +110,8 @@
22 except Exception:
23 icon = self.icons.load_icon(MISSING_APP_ICON,
24 self.ICON_SIZE, 0)
25- status_text = self._render_status_text(appname, trans.status)
26+ status = get_status_string_from_enum(trans.status)
27+ status_text = self._render_status_text(appname, status)
28 cancel_icon = self._get_cancel_icon(trans.cancellable)
29 self.append([trans.tid, icon, appname, status_text, trans.progress,
30 cancel_icon])
31@@ -135,6 +139,13 @@
32 for row in self:
33 if row[self.COL_TID] == trans.tid:
34 row[self.COL_PROGRESS] = progress
35+ if trans.status == STATUS_DOWNLOADING:
36+ name = row[self.COL_NAME]
37+ current_bytes = apt_pkg.SizeToStr(trans.progress_details[2])
38+ total_bytes = apt_pkg.SizeToStr(trans.progress_details[3])
39+ status = _("Downloaded %sB of %sB") % \
40+ (current_bytes, total_bytes)
41+ row[self.COL_STATUS] = self._render_status_text(name, status)
42
43 def _on_status_changed(self, trans, status):
44 #print "_on_progress_changed: ", trans, status
45@@ -143,13 +154,13 @@
46 # FIXME: the spaces around %s are poor mans padding because
47 # setting xpad on the cell-renderer seems to not work
48 name = row[self.COL_NAME]
49- row[self.COL_STATUS] = self._render_status_text(name, status)
50+ st = get_status_string_from_enum(status)
51+ row[self.COL_STATUS] = self._render_status_text(name, st)
52
53 def _render_status_text(self, name, status):
54 if not name:
55 name = ""
56- return "%s\n<small>%s</small>" % (name,
57- get_status_string_from_enum(status))
58+ return "%s\n<small>%s</small>" % (name, status)
59
60
61 class PendingView(gtk.TreeView):