GNOME Bugzilla – Bug 336562
Exposing AT-SPI AccessibleSelections
Last modified: 2006-04-01 02:25:49 UTC
dogtail doesn't currently expose an API for dealing with AccessibleSelection instances. Patch to follow which adds this API. Depends on bug #336561 which adds the binding ofAccessibleSelection to pyspi.
Created attachment 62344 [details] [review] Patch to expose AccessibleSelection instances.
Created attachment 62381 [details] [review] Enhanced patch to add support to atk selection in dogtail I got Peter's patch, and added some functions to make it more confortable to use. * Added a "selectedChildren" attribute to Node, enabling you to recover the set of selected accessibles. * Added a "select()" method to Node. It gets the parent and selects the node in the parent. It should fix #333887 (navigation through tabs in dogtail). As an example of how to select a tab would be: focus.application('gedit') focus.widget(roleName='page tab', name='My tab') focus.widget.node.select()
I think the right way to expose this is: node instance (f.e. page tab list) Node selectedChild() - returns the selected node node instance (f.e. page tab) bool isSelected bool select() Exposing anything else publically would be too complex. We can easily hide the pyspi methods and just expose these two methods and one property.
Here's my patch. It adds everything I proposed, except selectedChild() is now the selectedChildren attribute, returning the list of selected children since apparently multiple children can be selected (Jose got this right, I overlooked it ;). It also adds the indexInParent attribute, such that node.parent.children[node.indexInParent] would give you the same node. It also adds selectAll(), to select all the children; and deselectAll, to deselect all selected children. AT-SPI does provide a deselectSelectedChild(), but the index it wants is not the index in its parent, but something in range(foo.getNSelectedChildren()). There doesn't seem to be a reliable way for a node to track what its "selection index" is, so we'll have to deal with the fact that if you want to deselect any node, you have to call node.parent.deselectAll() instead of being able to call node.deselect().
Created attachment 62501 [details] [review] Revised patch with simpler API
Created attachment 62502 [details] [review] Revised patch + deselect() Peter thought of a good way to implement deselect(), so I implemented it and added it to the patch. Yay!
OK, I've committed the patch. deselect() is hard to test, so I'll have to test it later. If anyone finds that it doesn't work where it should, please reopen. Thanks guys!