[Sugar-devel] [PATCH 1/2] Revert to original layout (<=v35) for Sugar <=0.84

Gonzalo Odiard gonzalo at laptop.org
Mon Nov 1 18:13:39 EDT 2010


I don't understand why Pippy do:

        goicon_bw = gtk.Image()
        goicon_bw.set_from_file("%s/icons/run_bw.svg" % os.getcwd())
        goicon_color = gtk.Image()
        goicon_color.set_from_file("%s/icons/run_color.svg" % os.getcwd())
        gobutton = ToolButton(label=_("_Run!"))
        gobutton.props.accelerator = _('<alt>r')
        gobutton.set_icon_widget(goicon_bw)
        gobutton.set_tooltip("Run")
        gobutton.connect('clicked', self.flash_cb, dict({'bw':goicon_bw,
            'color':goicon_color}))
        gobutton.props.accelerator = _('<alt>r')
        gobutton.connect('clicked', self.gobutton_cb)

instead of:

        gobutton = ToolButton('run_bw')
        gobutton.set_tooltip("Run")
        gobutton.props.accelerator = _('<alt>r')
        gobutton.connect('clicked', self.gobutton_cb)

You lost the flash color when press the button, but is not a standard
behavior in Sugar.
The Toolbutton (and Icon too) take the image from the icons directory with
the name, you don't  need:

        menu_item.set_image(Icon(file=('%s/activity/activity-default.svg' %
get_bundle_path()),  icon_size=gtk.ICON_SIZE_MENU))
you can do:
        menu_item.set_image(Icon(icon_name='activity-default',
icon_size=gtk.ICON_SIZE_MENU))

if the icon is in the icons directory (and is a good idea)

Also, why you put the buttons in a table in the Toolbar for 0.84?
And use gtk.Buttons in the toolbar for 0.84? You can use ToolButton in 0.84

 I think the code can be simplified.

Gonzalo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101101/39f79550/attachment.html>


More information about the Sugar-devel mailing list