Re: [orca-list] help debugging a problem



Hi Joanie and all.
Thanks, it works but I need more help.
It seems to me that there is a problem with the routine getAccessibleAt.
I am try to retrieve a cell using this function but sometimes it does
not work.
I am sending the program and the result.
Sorry for the long message.

#!/usr/bin/python
import pyatspi
def getLabels(obj):
    label = []
    for j in range(0, obj.childCount):
        cell = obj.getChildAtIndex(j)
        if not cell:
            continue
        state = cell.getState()
        label.append(cell.name)

    return label

def blah(event):
    obj = event.any_data
    parentTable = obj.parent.queryTable()
    index = obj.getIndexInParent()
    row = parentTable.getRowAtIndex(index)
    column = parentTable.getColumnAtIndex(index)
    print row, column, parentTable.nColumns
    print getLabels(obj)
    for i in range(0, parentTable.nColumns):
        cell = parentTable.getAccessibleAt(row, i)
        if not cell:
            continue
        print getLabels(cell)

pyatspi.Registry.registerEventListener(blah,
"object:active-descendant-changed")
pyatspi.Registry.start()

The result:

8 0 1
['', 'Ts1.java']
['', 'Ts1.java']
9 0 1
['', 'Ts1a.java']
['', 'Ts1a.java']
10 0 1
['', 'Ts2.java']
['', 'Ts2.java']
11 0 1
['', 'JRE System Library [JavaSE-1.6]']
['', 'teste']
12 0 1
['', 'Referenced Libraries']
['', 'teste']
13 0 1
['', 'JUnit 4']
['', 'teste']

The program printsevent.any_data and the cell retrieved by the function
getAccessibleAt.
Both results are the same until appears the value 'JRE System Library'.
Any idea?
Thanks.

On 06/27/2010 01:34 AM, Joanmarie Diggs wrote:
Hey José.

I am trying to solve Bug 525316.

Yay! Thank you!

To do this I decided to create a small program to simulate the logic
used on orca but I don't know how to get the label associated to a cell.

Does the cell have children which are also cells? If so, go through the
children and find the one which has a name. The name should correspond
to the text being displayed.

Often the reported active descendant isn't the real active descendant.
At least from where we're sitting....

HTH.
--joanie




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]