[Sugar-devel] [DESIGN] Proposal: icons for Record Timer and Duration

Sascha Silbe sascha-ml-reply-to-2011-3 at silbe.org
Fri Jul 8 14:42:50 EDT 2011


Excerpts from Gary Martin's message of Fri Jul 08 16:55:22 +0200 2011:

> Absolutely, that mockup looks great. Does anyone know how to put an icon in the gtk combo widget, I'm sure there are some other places in Sugar and other activities that would make good use of this technique!

gtk.ComboBox interfaces to a TreeModel and is supposed to support the
full capabilities of this model. Multiple columns certainly work. From
Backup [1]:


        self._media_combo_model = gtk.ListStore(str, str, str, str)
        self._media_combo = gtk.ComboBox(self._media_combo_model)
        if not pre_086_toolbars:
            icon_renderer = CellRendererIcon(self._media_combo)
            icon_renderer.props.xo_color = self._color
            icon_renderer.props.width = style.STANDARD_ICON_SIZE + \
                style.DEFAULT_SPACING
            icon_renderer.props.height = style.STANDARD_ICON_SIZE
            icon_renderer.props.size = style.STANDARD_ICON_SIZE
            icon_renderer.props.xpad = style.DEFAULT_PADDING
            icon_renderer.props.ypad = style.DEFAULT_PADDING
            self._media_combo.pack_start(icon_renderer, False)
            self._media_combo.add_attribute(icon_renderer, 'icon_name',
                self._MEDIA_COMBO_ICON_COLUMN)
        # FIXME: icon_renderer for pre-0.86

        name_renderer = gtk.CellRendererText()
        self._media_combo.pack_start(name_renderer, False)
        self._media_combo.add_attribute(name_renderer, 'text',
            self._MEDIA_COMBO_NAME_COLUMN)
        free_renderer = gtk.CellRendererText()
        self._media_combo.pack_start(free_renderer, False)
        self._media_combo.add_attribute(free_renderer, 'text',
            self._MEDIA_COMBO_FREE_COLUMN)

        tool_item = gtk.ToolItem()
        tool_item.add(self._media_combo)
        # FIXME: looks like plain GTK, not like Sugar
        tooltip_text = _('Storage medium to store the backup on')
        tool_item.set_tooltip_text(tooltip_text.encode('utf-8'))
        toolbar.insert(tool_item, -1)


For pre-0.86 you'd have to either find a replacement for
sugar.graphics.icon.CellRendererIcon or bundle a copy of it. Please CC
me on the patch so I can do the same in Backup. :)

Sascha

[1] http://git.sugarlabs.org/backup/mainline/blobs/master/backup.py#line518
-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 500 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110708/09ea54ce/attachment.pgp>


More information about the Sugar-devel mailing list