[Sugar-devel] Set accelerator in gtk.ToggleToolButton

Manuel Kaufmann humitos at gmail.com
Thu May 31 12:33:42 EDT 2012


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/


More information about the Sugar-devel mailing list