pyLinAcc :: Accessible :: AccessibleMixin :: Class AccessibleMixin
[hide private]
[frames] | no frames]

Class AccessibleMixin

source code

object --+
         |
        AccessibleMixin

Defines additional methods to be added to the AT-SPI Accessible object. The features defined here will be added to the Accessible class at run time so that all instances of Accessible have them (i.e. there is no need to explicitly wrap an Accessible in this class or derive a new class from it.)

Instance Methods [hide private]
 
__del__(self)
Decrements the reference count on the accessible object when there are no Python references to this object.
source code
Accessibility.Accessible
__iter__(self)
Iterator that yields one accessible child per iteration.
source code
string
__str__(self)
Gets a human readable representation of the accessible.
source code
boolean
__nonzero__(self)
Returns: True, always
source code
Accessibility.Accessible
__getitem__(self, index)
Thin wrapper around getChildAtIndex.
source code
integer
__len__(self)
Thin wrapper around childCount.
source code
integer
getIndexInParent(self)
Gets the index of this accessible in its parent.
source code
Accessibility.Accessible or None
findDescendant(self, pred, breadth_first=False)
Searches for a descendant node satisfying the given predicate starting at this node.
source code
Accessibility.Accessible or None
_findDescendantBreadth(self, pred)
Internal function for locating one descendant.
source code
Accessibility.Accessible or None
_findDescendantDepth(self, pred)
Internal function for locating one descendant.
source code
list
findAllDescendants(self, pred)
Searches for all descendant nodes satisfying the given predicate starting at this node.
source code
Accessibility.Accessible or None
findIterDescendants(self, pred)
Iterator that yields Accessibility.Accessible that passed search criteria defined by pred.
source code
Accessibility.Accessible or None
findAncestor(self, pred)
Searches for an ancestor satisfying the given predicate.
source code
Accessibility.Application
getApplication(self)
Gets the most-parent accessible (the application) of this accessible.
source code
boolean
isAlive(self)
Verifies that the underlying CORBA object still exists.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__del__(self)
(Destructor)

source code 

Decrements the reference count on the accessible object when there are no Python references to this object. This provides automatic reference counting for AT-SPI objects.

__iter__(self)

source code 

Iterator that yields one accessible child per iteration. If an exception is encountered, None is yielded instead.

Returns: Accessibility.Accessible
A child accessible

__str__(self)
(Informal representation operator)

source code 

Gets a human readable representation of the accessible.

Returns: string
Role and name information for the accessible
Overrides: object.__str__

__nonzero__(self)
(Boolean test operator)

source code 
Returns: boolean
True, always

__getitem__(self, index)
(Indexing operator)

source code 

Thin wrapper around getChildAtIndex.

Parameters:
  • index (integer) - Index of desired child
Returns: Accessibility.Accessible
Accessible child

__len__(self)
(Length operator)

source code 

Thin wrapper around childCount.

Returns: integer
Number of child accessibles

getIndexInParent(self)

source code 

Gets the index of this accessible in its parent. Uses the implementation of this method provided by the Accessibility.Accessible object, but checks the bound of the value to ensure it is not outside the range of childCount reported by this accessible's parent.

Returns: integer
Index of this accessible in its parent

findDescendant(self, pred, breadth_first=False)

source code 

Searches for a descendant node satisfying the given predicate starting at this node. The search is performed in depth-first order by default or in breadth first order if breadth_first is True. For example,

my_win = node.findDescendant(lambda x: x.name == 'My Window')

will search all descendants of node until one is located with the name 'My Window' or all nodes are exausted. Calls _findDescendantDepth or _findDescendantBreadth to start the recursive search.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
  • breadth_first (boolean) - Search breadth first (True) or depth first (False)?
Returns: Accessibility.Accessible or None
Accessible matching the criteria or None if not found

_findDescendantBreadth(self, pred)

source code 

Internal function for locating one descendant. Called by AccessibleMixin.findDescendant to start the search.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
Returns: Accessibility.Accessible or None
Matching node or None to keep searching

_findDescendantDepth(self, pred)

source code 

Internal function for locating one descendant. Called by AccessibleMixin.findDescendant to start the search.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
Returns: Accessibility.Accessible or None
Matching node or None to keep searching

findAllDescendants(self, pred)

source code 

Searches for all descendant nodes satisfying the given predicate starting at this node. For example,

pred = lambda x: x.getRole() == Accessible.ROLE_PUSH_BUTTON buttons = node.findAllDescendants(pred)

will locate all push button descendants of the current node. Calls findIterDescendants to start the exhaustive recursive search.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
Returns: list
All nodes matching the search criteria

findIterDescendants(self, pred)

source code 

Iterator that yields Accessibility.Accessible that passed search criteria defined by pred. The search is performed in depth-first order and the results are returned in that order.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
Returns: Accessibility.Accessible or None
A node matching the search criteria

findAncestor(self, pred)

source code 

Searches for an ancestor satisfying the given predicate. Note that the AT-SPI DOM is not perfectly doubly linked. Node A may consider node B its child, but B is not guaranteed to have node A as its parent (i.e. its parent may be set to None). This means some searches may never make it all the way up the DOM to the desktop level.

Parameters:
  • pred (callable) - Search predicate returning True if accessible matches the search criteria or False otherwise
Returns: Accessibility.Accessible or None
Node matching the criteria or None if not found

getApplication(self)

source code 

Gets the most-parent accessible (the application) of this accessible. Tries using the getApplication method introduced in AT-SPI 1.7.0 first before resorting to traversing parent links.

Returns: Accessibility.Application
Application object

Warning: Cycles involving more than the previously traversed accessible are not detected by this code.

isAlive(self)

source code 

Verifies that the underlying CORBA object still exists.

Returns: boolean
True if the CORBA object is still valid. False if not.