[pygtk] Re: Need help with GtkToolItemType setting
Артём Попов
artfwo at gmail.com
Thu Aug 10 19:30:58 WST 2006
Never mind, I've just figured out that a __gtype_name__ line needs to
be added and everything then works as expected. This is a working
version:
class MenuToolAction(gtk.Action):
__gtype_name__ = "MenuToolAction"
MenuToolAction.set_tool_item_type(gtk.MenuToolButton)
But I'm still wondering, why the first version did not work? Isn't
__gtype_name__ set automatically nowadays?
--Artem
2006/8/10, Артём Попов <artfwo at gmail.com>:
> Hello,
>
> I've been trying to use the new (in 2.9.4) feature of setting ToolItem
> type in gtk.Action, (I need a toolitem with a dropdown menu). I was
> doing something like:
>
> class MenuToolAction(gtk.Action):
> pass
> MenuToolAction.set_tool_item_type(gtk.MenuToolButton)
>
> ...then creating a bunch of actions the usual way (the entries), then
> doing something like:
>
> custom_action = MenuToolAction()
> group.add_action(custom_action)
>
> The result is bizzare: ALL toolbar buttons now have a (disabled) arrow
> next to them, only the actual action, that should have a menu has the
> enabled arrow with the dropdown menu.
>
> I realize, that by calling
> "MenuToolAction.set_tool_item_type(gtk.MenuToolButton)" I somehow set
> the "tool_item_type" class attribute for gtk.Action and NOT my
> subclass. Then, how do I set the attribute only for the subclass? I
> apologize, if I'm asking a dumb question, but I simply have not done
> anything like this before. Thanks in advance for your help.
>
> --Artem
>
More information about the pygtk
mailing list