[Sugar-devel] [sugar] Show summary information in the activities list view

Simon Schampijer simon at schampijer.de
Thu Sep 20 04:01:51 EDT 2012


Thanks Gonzalo for your patch!

Gary, Manuel, how should we best represent this visually? Attached is a 
screenshot of the Activity listview after Gonzalo's changes.

Regards,
    Simon


On 09/19/2012 11:47 PM, godiard at sugarlabs.org wrote:
> 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)
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: summary.png
Type: image/png
Size: 60938 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120920/f6174b52/attachment-0001.png>


More information about the Sugar-devel mailing list