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
=== modified file 'softwarecenter/ui/gtk3/panes/historypane.py'
--- softwarecenter/ui/gtk3/panes/historypane.py 2012-03-15 00:52:10 +0000
+++ softwarecenter/ui/gtk3/panes/historypane.py 2012-05-17 18:24:19 +0000
@@ -25,6 +25,7 @@
2525
26from gettext import gettext as _26from gettext import gettext as _
2727
28from softwarecenter.ui.gtk3.em import get_em
28from softwarecenter.ui.gtk3.widgets.spinner import SpinnerNotebook29from softwarecenter.ui.gtk3.widgets.spinner import SpinnerNotebook
29from basepane import BasePane30from basepane import BasePane
30from softwarecenter.enums import Icons31from softwarecenter.enums import Icons
@@ -49,8 +50,8 @@
4950
50 (ALL, INSTALLED, REMOVED, UPGRADED) = range(4)51 (ALL, INSTALLED, REMOVED, UPGRADED) = range(4)
5152
52 ICON_SIZE = 3253 ICON_SIZE = 1.2 * get_em()
53 PADDING = 654 PADDING = 4
5455
55 # pages for the spinner notebook56 # pages for the spinner notebook
56 (PAGE_HISTORY_VIEW,57 (PAGE_HISTORY_VIEW,
@@ -143,12 +144,19 @@
143 self.column = Gtk.TreeViewColumn(_('Date'))144 self.column = Gtk.TreeViewColumn(_('Date'))
144 self.view.append_column(self.column)145 self.view.append_column(self.column)
145 self.cell_icon = Gtk.CellRendererPixbuf()146 self.cell_icon = Gtk.CellRendererPixbuf()
147 self.cell_icon.set_padding(self.PADDING, self.PADDING/2)
146 self.column.pack_start(self.cell_icon, False)148 self.column.pack_start(self.cell_icon, False)
147 self.column.set_cell_data_func(self.cell_icon, self.render_cell_icon)149 self.column.set_cell_data_func(self.cell_icon, self.render_cell_icon)
148 self.cell_text = Gtk.CellRendererText()150 self.cell_text = Gtk.CellRendererText()
149 self.column.pack_start(self.cell_text, True)151 self.column.pack_start(self.cell_text, True)
150 self.column.set_cell_data_func(self.cell_text, self.render_cell_text)152 self.column.set_cell_data_func(self.cell_text, self.render_cell_text)
153 self.cell_time = Gtk.CellRendererText()
154 self.cell_time.set_padding(6, 0)
155 self.cell_time.set_alignment(1.0, 0.5)
156 self.column.pack_end(self.cell_time, False)
157 self.column.set_cell_data_func(self.cell_time, self.render_cell_time)
151158
159
152 # busy cursor160 # busy cursor
153 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)161 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
154162
@@ -351,22 +359,7 @@
351 if isinstance(when, datetime.datetime):359 if isinstance(when, datetime.datetime):
352 action = store.get_value(iter, self.COL_ACTION)360 action = store.get_value(iter, self.COL_ACTION)
353 pkg = store.get_value(iter, self.COL_PKG)361 pkg = store.get_value(iter, self.COL_PKG)
354 subs = {'pkgname': pkg,362 text = pkg
355 'color': '#8A8A8A',
356 # Translators : time displayed in history, display hours
357 # (0-12), minutes and AM/PM. %H should be used instead
358 # of %I to display hours 0-24
359 'time': when.time().strftime(_('%I:%M %p')),
360 }
361 if action == self.INSTALLED:
362 text = _('%(pkgname)s <span color="%(color)s">'
363 'installed %(time)s</span>') % subs
364 elif action == self.REMOVED:
365 text = _('%(pkgname)s <span color="%(color)s">'
366 'removed %(time)s</span>') % subs
367 elif action == self.UPGRADED:
368 text = _('%(pkgname)s <span color="%(color)s">'
369 'updated %(time)s</span>') % subs
370 elif isinstance(when, datetime.date):363 elif isinstance(when, datetime.date):
371 today = datetime.date.today()364 today = datetime.date.today()
372 monday = today - datetime.timedelta(days=today.weekday())365 monday = today - datetime.timedelta(days=today.weekday())
@@ -384,6 +377,27 @@
384 text = when.strftime(_('%d %B %Y'))377 text = when.strftime(_('%d %B %Y'))
385 cell.set_property('markup', text)378 cell.set_property('markup', text)
386379
380 def render_cell_time(self, column, cell, store, iter, user_data):
381 when = store.get_value(iter, self.COL_WHEN)
382 text = ''
383 if isinstance(when, datetime.datetime):
384 action = store.get_value(iter, self.COL_ACTION)
385 # Translators : time displayed in history, display hours
386 # (0-12), minutes and AM/PM. %H should be used instead
387 # of %I to display hours 0-24
388 time_text = when.time().strftime(_('%I:%M %p'))
389 if self.filter is not self.ALL:
390 action_text = time_text
391 else:
392 if action == self.INSTALLED:
393 action_text = _('installed %s') % time_text
394 elif action == self.REMOVED:
395 action_text = _('removed %s') % time_text
396 elif action == self.UPGRADED:
397 action_text = _('updated %s') % time_text
398 text = '<span color="%(color)s">%(action)s</span>'% {'color': '#8A8A8A', 'action': action_text }
399 cell.set_property('markup', text)
400
387401
388def get_test_window():402def get_test_window():
389403