While adding the bookmarklet functionality to Browse, I realised that
the toolbox API is hard to work with if your toolbars change. For
example, set_current_toolbar() takes the index of the toolbar as a
parameter, something which you can't really know if your toolbars move
around.

Tomeu suggested I propose to extend the toolbox API with a
get_toolbars() method. This method returns a list of the actual
Toolbar objects, in the order they currently have in the gtk.Notebook.
This method allows for things like if toolbar in
toolbox.get_toolbars() or toolbar_index =
toolbox.get_toolbars().index(toolbar), giving a lot more flexibility
in manipulating toolbars.
It could also kill off the ugly _TOOLBAR_FOO globals in Browse.

I've made toolbox.toolbars a property for get_toolbars().

I have attached a patch to toolbox.py, in the sugar.graphics package.

Attachment: get_toolbars.patch
Description: Binary data

_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to