Merge lp:~evfool/software-center/history-enhancements into lp:software-center

Proposed by Robert Roth
Status: Merged
Merged at revision: 3015
Proposed branch: lp:~evfool/software-center/history-enhancements
Merge into: lp:software-center
Diff against target: 93 lines (+32/-18)
1 file modified
softwarecenter/ui/gtk3/panes/historypane.py (+32/-18)
To merge this branch: bzr merge lp:~evfool/software-center/history-enhancements
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+106236@code.launchpad.net

Description of the change

This branch contains the following changes (specified at https://wiki.ubuntu.com/SoftwareCenter#History_enhancements):
* display text-sized icons in history, not double-sized ones
* use padding between the icon and the package name
* right-align the time of the history action
* display the action +time (installed/updated/removed) if the filter is all changes, otherwise only display the time
* removed markup from the translatable string, to avoid translation mistakes with markup

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

Thanks, that is fine for trunk.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/panes/historypane.py'
2--- softwarecenter/ui/gtk3/panes/historypane.py 2012-03-15 00:52:10 +0000
3+++ softwarecenter/ui/gtk3/panes/historypane.py 2012-05-17 18:24:19 +0000
4@@ -25,6 +25,7 @@
5
6 from gettext import gettext as _
7
8+from softwarecenter.ui.gtk3.em import get_em
9 from softwarecenter.ui.gtk3.widgets.spinner import SpinnerNotebook
10 from basepane import BasePane
11 from softwarecenter.enums import Icons
12@@ -49,8 +50,8 @@
13
14 (ALL, INSTALLED, REMOVED, UPGRADED) = range(4)
15
16- ICON_SIZE = 32
17- PADDING = 6
18+ ICON_SIZE = 1.2 * get_em()
19+ PADDING = 4
20
21 # pages for the spinner notebook
22 (PAGE_HISTORY_VIEW,
23@@ -143,12 +144,19 @@
24 self.column = Gtk.TreeViewColumn(_('Date'))
25 self.view.append_column(self.column)
26 self.cell_icon = Gtk.CellRendererPixbuf()
27+ self.cell_icon.set_padding(self.PADDING, self.PADDING/2)
28 self.column.pack_start(self.cell_icon, False)
29 self.column.set_cell_data_func(self.cell_icon, self.render_cell_icon)
30 self.cell_text = Gtk.CellRendererText()
31 self.column.pack_start(self.cell_text, True)
32 self.column.set_cell_data_func(self.cell_text, self.render_cell_text)
33+ self.cell_time = Gtk.CellRendererText()
34+ self.cell_time.set_padding(6, 0)
35+ self.cell_time.set_alignment(1.0, 0.5)
36+ self.column.pack_end(self.cell_time, False)
37+ self.column.set_cell_data_func(self.cell_time, self.render_cell_time)
38
39+
40 # busy cursor
41 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
42
43@@ -351,22 +359,7 @@
44 if isinstance(when, datetime.datetime):
45 action = store.get_value(iter, self.COL_ACTION)
46 pkg = store.get_value(iter, self.COL_PKG)
47- subs = {'pkgname': pkg,
48- 'color': '#8A8A8A',
49- # Translators : time displayed in history, display hours
50- # (0-12), minutes and AM/PM. %H should be used instead
51- # of %I to display hours 0-24
52- 'time': when.time().strftime(_('%I:%M %p')),
53- }
54- if action == self.INSTALLED:
55- text = _('%(pkgname)s <span color="%(color)s">'
56- 'installed %(time)s</span>') % subs
57- elif action == self.REMOVED:
58- text = _('%(pkgname)s <span color="%(color)s">'
59- 'removed %(time)s</span>') % subs
60- elif action == self.UPGRADED:
61- text = _('%(pkgname)s <span color="%(color)s">'
62- 'updated %(time)s</span>') % subs
63+ text = pkg
64 elif isinstance(when, datetime.date):
65 today = datetime.date.today()
66 monday = today - datetime.timedelta(days=today.weekday())
67@@ -384,6 +377,27 @@
68 text = when.strftime(_('%d %B %Y'))
69 cell.set_property('markup', text)
70
71+ def render_cell_time(self, column, cell, store, iter, user_data):
72+ when = store.get_value(iter, self.COL_WHEN)
73+ text = ''
74+ if isinstance(when, datetime.datetime):
75+ action = store.get_value(iter, self.COL_ACTION)
76+ # Translators : time displayed in history, display hours
77+ # (0-12), minutes and AM/PM. %H should be used instead
78+ # of %I to display hours 0-24
79+ time_text = when.time().strftime(_('%I:%M %p'))
80+ if self.filter is not self.ALL:
81+ action_text = time_text
82+ else:
83+ if action == self.INSTALLED:
84+ action_text = _('installed %s') % time_text
85+ elif action == self.REMOVED:
86+ action_text = _('removed %s') % time_text
87+ elif action == self.UPGRADED:
88+ action_text = _('updated %s') % time_text
89+ text = '<span color="%(color)s">%(action)s</span>'% {'color': '#8A8A8A', 'action': action_text }
90+ cell.set_property('markup', text)
91+
92
93 def get_test_window():
94