Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import pyatspi
- def listener(e):
- if not e.detail1:
- return
- obj = e.source
- if not obj.getRole() == pyatspi.ROLE_TABLE_CELL:
- return
- isTable = lambda x: 'Table' in pyatspi.utils.listInterfaces(x)
- parentTable = pyatspi.utils.findAncestor(obj, isTable)
- if not parentTable:
- print 'table not found'
- return
- iTable = parentTable.queryTable()
- contact = obj.name
- index = obj.getIndexInParent()
- cRow = iTable.getRowAtIndex(index)
- cCol = iTable.getColumnAtIndex(index)
- print '\nFocused Contact: %s (row: %s col: %s)' % (contact, cRow, cCol)
- print 'Contact at (%s, %s): %s' % (cRow, cCol, iTable.getAccessibleAt(cRow, cCol))
- print 'All Contacts:'
- for row in range(iTable.nRows):
- # contact name seems to be in the first column
- print ' row %i: %s' % (row, iTable.getAccessibleAt(row, 0).name)
- pyatspi.Registry.registerEventListener(listener, 'object:state-changed:focused')
- pyatspi.Registry.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement