Package AccessEngine :: Package AEWalkers :: Module AccessibleItemWalker :: Class AccessibleItemWalker
[hide private]
[frames] | no frames]

Class AccessibleItemWalker

source code

   object --+    
            |    
Base.AEWalker --+
                |
               AccessibleItemWalker

Walks the accessible hierarchy by accessibles and their items returning AEPors. The walk order is an in-order traversal of the subtree of the accessible hierarchy rooted at a top-level window accessible. The subtree is assumed to have no loops, though logic could be added to detect them. The supported flags determine whether invisible or trivial items are skipped or not. This class uses the AEAccInterfaces to leave the decision of what constitutes an item, what constitutes a trivial accessible, and what constitutes and invisible accessible to the objects that implement the interfaces.

Instance Methods [hide private]
 
__init__(self, por, only_visible=True, allow_trivial=False)
Stores the starting AEPor.
source code
2-tuple of AEPor, callable
_getNextItem(self, por)
Gets the next item in the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getFirstChild(self, por)
Gets the first child of the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getNextPeer(self, por)
Gets the next peer of the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getParentNextItem(self, por)
Gets the next item in the parent accessible of the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getPrevItem(self, por)
Gets the previous item in the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getPrevPeer(self, por)
Gets the previous peer of the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getParentPrevItem(self, por)
Gets the previous item in the parent accessible of the current accessible in the given AEPor.
source code
2-tuple of AEPor, callable
_getLastChild(self, por)
Gets the last child of the accessible in the given AEPor.
source code
AEPor
_getLastItem(self, por)
Gets the last visible item of the given AEPor.
source code
2-tuple of AEPor, callable
_getParent(self, por)
Gets the parent accessible of the one in the given AEPor.
source code
AEPor or None
getNextPOR(self)
Gets the next AEPor in the walk order.
source code
AEPor or None
getPrevPOR(self)
Gets the previous AEPor in the walk order.
source code
AEPor
getFirstPOR(self)
Gets the first AEPor in the walk order.
source code
AEPor
getLastPOR(self)
Gets the last AEPor in the walk order.
source code
AEPor
getParentPOR(self)
Gets the parent AEPor of the current AEPor.
source code

Inherited from Base.AEWalker: getCurrPOR

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

Instance Variables [hide private]
boolean allow_invisible
Stop on invisible AEPors as well as visible?
boolean allow_trivial
Stop on trivial AEPors as well as non-trivial?

Inherited from Base.AEWalker: por

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, por, only_visible=True, allow_trivial=False)
(Constructor)

source code 
Stores the starting AEPor.
Parameters:
  • only_visible (boolean) - Stop only on visible AEPors?
  • allow_trivial (boolean) - Stop on trivial AEPors as well as non-trivial?
  • por (AEPor) - The current AEPor for the AEWalker
Overrides: Base.AEWalker.__init__

_getNextItem(self, por)

source code 
Gets the next item in the current accessible in the given AEPor. Returns that next item if it exists. If not or if the accessible in the given AEPor is not visible, returns the current AEPor and the _getFirstChild as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getFirstChild(self, por)

source code 
Gets the first child of the current accessible in the given AEPor. Returns the child accessible if it exists, is visible, and is not trivial. If it does not exist or is invisible, returns the given AEPor and _getNextPeer as the method to call to continue the search. If it is trivial, returns the child accessible and _getFirstChild as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getNextPeer(self, por)

source code 
Gets the next peer of the current accessible in the given AEPor. Returns the peer accessible if it exists, is visible, and is not trivial. If it does not exist, returns the given AEPor and _getParentNextItem as the method to call to continue the search. If it is invisible, returns the peer AEPor and _getNextPeer as the method to call to continue the search. If it is trivial, returns the peer and _getFirstChild as the method to call to continue the search. If it is trivial, returns the child accessible and _getFirstChild as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getParentNextItem(self, por)

source code 
Gets the next item in the parent accessible of the current accessible in the given AEPor. Returns the next item if it exists. Else, returns the parent accessible and _getNextPeer as the method to call to continue the search if the parent exists. Returns a sentinel (None, None) if there is no parent indicating the given AEPor is the root of the subtree containing the starting AEPor.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getPrevItem(self, por)

source code 
Gets the previous item in the current accessible in the given AEPor. Returns that previous item if it exists. If not or if the accessible in the given AEPor is not visible, returns the current AEPor and the _getPrevPeer as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getPrevPeer(self, por)

source code 
Gets the previous peer of the current accessible in the given AEPor. If it does not exist, returns the given AEPor and _getParent as the method to call to continue the search. If it is not visible, returns the peer accessible and _getPrevPeer as the method to call to continue the search. Otherwise, returns the peer accessible and _getLastChild as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getParentPrevItem(self, por)

source code 
Gets the previous item in the parent accessible of the current accessible in the given AEPor. Returns the previous item if it exists. Else, returns the parent accessible and _getParent as the method to call to continue the search if the parent exists. Returns a sentinel (None, None) if there is no parent indicating the given AEPor is the root of the subtree containing the starting AEPor.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getLastChild(self, por)

source code 

Gets the last child of the accessible in the given AEPor. If it does not exist, checks if the given AEPor is invisible or trivial. If so, returns the given AEPor and _getPrevPeer to continue the search. If not, returns a AEPor to the last item in the given AEPor as the result.

If the last child does exist, checks if it is visible. If so, returns the child and _getLastChild to continue the search. If not, returns the child and _getPrevPeer to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete

_getLastItem(self, por)

source code 
Gets the last visible item of the given AEPor. Returns the given AEPor if any errors occur.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: AEPor
AEPor pointing to the last item of the accessible in the given AEPor

_getParent(self, por)

source code 
Gets the parent accessible of the one in the given AEPor. Returns the last item in the parent if it exists. If it does not exist, Returns a sentinel (None, None) indicating the given AEPor is the root of the subtree containing the starting AEPor. If the parent is invisible or trivial, returns the parent and _getPrevPeer as the method to call to continue the search.
Parameters:
  • por (AEPor) - Initial AEPor
Returns: 2-tuple of AEPor, callable
AEPor and the next method to call to continue the search, or AEPor and None to indicate the search is complete, or None and None to indicate we're at the root

getNextPOR(self)

source code 
Gets the next AEPor in the walk order. Calls _getNextItem, _getFirstChild, _getNextPeer, and _getParentNextItem to attempt to get the next valid AEPor. Each method determines whether the AEPor is valid as the next AEPor, and, if not, which call to make next. Each method potentially returns a AEPor and the next method to call to continue the search for the next AEPor.
Returns: AEPor or None
Next AEPor or None if this is the last AEPor
Overrides: Base.AEWalker.getNextPOR

getPrevPOR(self)

source code 
Gets the previous AEPor in the walk order. Calls _getPrevItem, _getPrevPeer, _getLastChild, and _getParentPrevItem to attempt to get the previous valid AEPor. Each method determines whether the AEPor is valid as the previous AEPor, and, if not, which call to make next. Each method potentially returns a AEPor and the next method to call to continue the search for the previous AEPor.
Returns: AEPor or None
Previous AEPor or None if this is the first AEPor
Overrides: Base.AEWalker.getPrevPOR

getFirstPOR(self)

source code 
Gets the first AEPor in the walk order. Searches up the accessible hierarchy until an accessible with no parent is encountered. The last visited child of that accessible is the first AEPor (i.e. the top-level window containing the starting AEPor).
Returns: AEPor
First AEPor
Overrides: Base.AEWalker.getFirstPOR

getLastPOR(self)

source code 
Gets the last AEPor in the walk order. Searches down the last child branch of the accessible hierarchy to the deepest accessible. The search then proceeds through previous AEPors in the walk order until the first visible, non-trivial accessible is encountered. The last item of that accessible is the last AEPor.
Returns: AEPor
Last AEPor
Overrides: Base.AEWalker.getLastPOR

getParentPOR(self)

source code 
Gets the parent AEPor of the current AEPor. Searches up the accessible hierarchy to find the first non-trivial, visible containing element.
Returns: AEPor
Parent AEPor or None if at root
Overrides: Base.AEWalker.getParentPOR