[Sugar-devel] [sugar] Show summary information in the activities list view
godiard at sugarlabs.org
godiard at sugarlabs.org
Wed Sep 19 17:47:16 EDT 2012
From: Gonzalo Odiard <godiard at gmail.com>
Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
src/jarabe/desktop/activitieslist.py | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
index fc05594..58e285c 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -25,7 +25,6 @@ from gi.repository import GConf
from gi.repository import Gtk
from gi.repository import Gdk
-from sugar3 import util
from sugar3.graphics import style
from sugar3.graphics.icon import Icon, CellRendererIcon
from sugar3.graphics.xocolor import XoColor
@@ -77,12 +76,9 @@ class ActivitiesTreeView(Gtk.TreeView):
self.append_column(column)
cell_text = Gtk.CellRendererText()
- cell_text.props.ellipsize = Pango.EllipsizeMode.MIDDLE
- cell_text.props.ellipsize_set = True
column = Gtk.TreeViewColumn()
column.props.sizing = Gtk.TreeViewColumnSizing.GROW_ONLY
- column.props.expand = True
column.set_sort_column_id(ListModel.COLUMN_TITLE)
column.pack_start(cell_text, True)
column.add_attribute(cell_text, 'markup', ListModel.COLUMN_TITLE)
@@ -96,24 +92,26 @@ class ActivitiesTreeView(Gtk.TreeView):
column.props.sizing = Gtk.TreeViewColumnSizing.GROW_ONLY
column.props.resizable = True
column.props.reorderable = True
- column.props.expand = True
column.set_sort_column_id(ListModel.COLUMN_VERSION)
column.pack_start(cell_text, True)
column.add_attribute(cell_text, 'text', ListModel.COLUMN_VERSION_TEXT)
self.append_column(column)
cell_text = Gtk.CellRendererText()
- cell_text.props.xalign = 1
+ cell_text.props.xalign = 0
+ cell_text.props.wrap_width = int(Gdk.Screen.width() / 3)
+ cell_text.props.wrap_mode = Pango.WrapMode.WORD
column = Gtk.TreeViewColumn()
- column.set_alignment(1)
column.props.sizing = Gtk.TreeViewColumnSizing.GROW_ONLY
column.props.resizable = True
column.props.reorderable = True
column.props.expand = True
- column.set_sort_column_id(ListModel.COLUMN_DATE)
+ column.props.max_width = int(Gdk.Screen.width() / 3)
+ column.props.spacing = 5
+ column.set_sort_column_id(ListModel.COLUMN_SUMMARY)
column.pack_start(cell_text, True)
- column.add_attribute(cell_text, 'text', ListModel.COLUMN_DATE_TEXT)
+ column.add_attribute(cell_text, 'text', ListModel.COLUMN_SUMMARY)
self.append_column(column)
self.set_search_column(ListModel.COLUMN_TITLE)
@@ -164,11 +162,10 @@ class ListModel(Gtk.TreeModelSort):
COLUMN_TITLE = 3
COLUMN_VERSION = 4
COLUMN_VERSION_TEXT = 5
- COLUMN_DATE = 6
- COLUMN_DATE_TEXT = 7
+ COLUMN_SUMMARY = 6
def __init__(self):
- self._model = Gtk.ListStore(str, bool, str, str, str, str, int, str)
+ self._model = Gtk.ListStore(str, bool, str, str, str, str, str)
self._model_filter = self._model.filter_new()
Gtk.TreeModelSort.__init__(self, model=self._model_filter)
@@ -208,7 +205,6 @@ class ListModel(Gtk.TreeModelSort):
if activity_info.get_bundle_id() == 'org.laptop.JournalActivity':
return
- timestamp = activity_info.get_installation_time()
version = activity_info.get_activity_version()
registry = bundleregistry.get_registry()
@@ -224,14 +220,15 @@ class ListModel(Gtk.TreeModelSort):
'<span style="italic" weight="light">%s</span>' % \
(activity_info.get_name(), tags)
+ summary = activity_info.get_summary()
+
self._model.append([activity_info.get_bundle_id(),
favorite,
activity_info.get_icon(),
title,
version,
_('Version %s') % version,
- int(timestamp),
- util.timestamp_to_elapsed_string(timestamp)])
+ summary])
def set_visible_func(self, func):
self._model_filter.set_visible_func(func)
--
1.7.11.4
More information about the Sugar-devel
mailing list