[Sugar-devel] Set accelerator in gtk.ToggleToolButton

Gonzalo Odiard gonzalo at laptop.org
Thu May 31 16:18:35 EDT 2012


The accelerator is not implemented in gtk.ToolButton, but in
sugar.graphics.toolbutton ToolButton.
I think we need implement the same in sugar.graphics.toogletoolbutton
ToggleToolButton,
but the code is a little complex (and we have bugs related to this),
then may be is better try to refactor ToolButton a little to allow share
the needed functionality.
May be is better look at this in 0.98

Gonzalo

On Thu, May 31, 2012 at 1:33 PM, Manuel Kaufmann <humitos at gmail.com> wrote:

> On Thu, May 31, 2012 at 10:42 AM, Gary Martin
> <garycmartin at googlemail.com> wrote:
> > Not that this helps much ;-)
>
> Thanks for your answer.
>
> I was looking at the code and I was thinking if this could be solved
> in Gtk3. I found that Gtk.ToggleToolButton inherits from
> Gtk.ToolButton[1]. So, it seems that now we are able to use
>
> ToggleToolButton.props.accelerator = '<Ctrl>B'
>
> to set the accelerator key.
>
> But unfortunately that doesn't work. I did a quick test with Read
> activity (that it's already ported to Gtk3) and I used the Bookmark
> button (it's a ToggleToolButton) but I get a similar error than in
> Gtk2. I don't understand why, because it inherits from Gtk.ToolButton
> and Gtk.ToolButton has that property :(
>
> Traceback (most recent call last):
>  File "/srv/sugar-jhbuild/install/bin/sugar-activity", line 146, in
> <module>
>    main()
>  File "/srv/sugar-jhbuild/install/bin/sugar-activity", line 141, in main
>    instance = create_activity_instance(activity_constructor,
> activity_handle)
>  File "/srv/sugar-jhbuild/install/bin/sugar-activity", line 34, in
> create_activity_instance
>    activity = constructor(handle)
>  File "/home/humitos/Activities/Read.activity/readactivity.py", line
> 223, in __init__
>    self._bookmarker.props.accelerator = '<Ctrl>D'
> AttributeError: 'gi._gobject.GProps' object has no attribute 'accelerator'
>
> [1] http://developer.gnome.org/gtk3/3.2/GtkToggleToolButton.html
>
> --
> Kaufmann Manuel
> Blog: http://humitos.wordpress.com/
> Porfolio: http://fotos.mkaufmann.com.ar/
> PyAr: http://www.python.com.ar/
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120531/4638674d/attachment.html>


More information about the Sugar-devel mailing list