Package virtualBuffers :: Class VirtualBuffer
[hide private]
[frames] | no frames]

Class VirtualBuffer

source code

                    object --+            
                             |            
 baseObject.AutoPropertyObject --+        
                                 |        
       baseObject.ScriptableObject --+    
                                     |    
           cursorManager.CursorManager --+
                                         |
                    object --+           |
                             |           |
 baseObject.AutoPropertyObject --+       |
                                 |       |
       baseObject.ScriptableObject --+   |
                                     |   |
treeInterceptorHandler.TreeInterceptor --+
                                         |
                                        VirtualBuffer

Nested Classes [hide private]
  TextInfo

Inherited from baseObject.AutoPropertyObject: __metaclass__

Instance Methods [hide private]
 
__init__(self, rootNVDAObject, backendName=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
prepare(self)
Prepares this treeInterceptor so that it becomes ready to accept event/script input.
source code
 
_get_shouldPrepare(self) source code
 
terminate(self)
Terminate this interceptor.
source code
 
_get_isReady(self) source code
 
loadBuffer(self) source code
 
_loadBuffer(self) source code
 
_loadBufferDone(self, success=True) source code
 
_loadProgress(self) source code
 
unloadBuffer(self) source code
 
makeTextInfo(self, position) source code
 
isNVDAObjectPartOfLayoutTable(self, obj) source code
NVDAObjects.NVDAObject
getNVDAObjectFromIdentifier(self, docHandle, ID)
Retrieve an NVDAObject for a given node identifier.
source code
2-tuple.
getIdentifierFromNVDAObject(self, obj)
Retreaves the virtualBuffer field identifier from an NVDAObject.
source code
 
event_treeInterceptor_gainFocus(self)
Triggered when this virtual buffer gains focus.
source code
 
event_treeInterceptor_loseFocus(self)
Triggered when this virtual buffer loses focus.
source code
 
event_caret(self, obj, nextHandler) source code
 
_activateNVDAObject(self, obj)
Activate an object in response to a user request.
source code
 
_activatePosition(self, info) source code
 
_set_selection(self, info, reason=speech.REASON_CARET) source code
 
_shouldSetFocusToObj(self, obj)
Determine whether an object should receive focus.
source code
 
script_activatePosition(self, gesture) source code
 
script_refreshBuffer(self, gesture) source code
 
script_toggleScreenLayout(self, gesture) source code
 
_searchableAttributesForNodeType(self, nodeType) source code
 
_iterNodesByType(self, nodeType, direction="next", offset=-1) source code
 
_iterNodesByAttribs(self, attribs, direction="next", offset=-1) source code
 
_quickNavScript(self, gesture, nodeType, direction, errorMessage, readUnit) source code
 
script_elementsList(self, gesture) source code
 
shouldPassThrough(self, obj, reason=None)
Determine whether pass through mode should be enabled or disabled for a given object.
source code
 
event_caretMovementFailed(self, obj, nextHandler, gesture=None) source code
 
script_disablePassThrough(self, gesture) source code
 
script_collapseOrExpandControl(self, gesture) source code
bool
_tabOverride(self, direction)
Override the tab order if the virtual buffer caret is not within the currently focused node.
source code
 
script_tab(self, gesture) source code
 
script_shiftTab(self, gesture) source code
 
event_focusEntered(self, obj, nextHandler) source code
bool
_shouldIgnoreFocus(self, obj)
Determines whether focus on a given object should be ignored.
source code
 
_postGainFocus(self, obj)
Executed after a gainFocus within the virtual buffer.
source code
 
_replayFocusEnteredEvents(self) source code
 
event_gainFocus(self, obj, nextHandler) source code
bool
_handleScrollTo(self, obj)
Handle scrolling the buffer to a given object in response to an event.
source code
 
_getTableCellCoords(self, info) source code
 
_iterTableCells(self, tableID, startPos=None, direction="next", row=None, column=None) source code
 
_getNearestTableCell(self, tableID, startPos, origRow, origCol, origRowSpan, origColSpan, movement, axis) source code
 
_tableMovementScriptHelper(self, movement="next", axis=None) source code
 
script_nextRow(self, gesture) source code
 
script_previousRow(self, gesture) source code
 
script_nextColumn(self, gesture) source code
 
script_previousColumn(self, gesture) source code
bool
_isNVDAObjectInApplication(self, obj)
Determine whether a given object is within an application.
source code
 
_iterNotLinkBlock(self, direction="next", offset=-1) source code
TextInfo position
_getInitialCaretPos(self)
Retrieve the initial position of the caret after the buffer has been loaded.
source code
 
_get_documentConstantIdentifier(self)
Get the constant identifier for this document.
source code
bool
_get_shouldRememberCaretPositionAcrossLoads(self)
Specifies whether the position of the caret should be remembered when this document is loaded again.
source code

Inherited from cursorManager.CursorManager: doFindText, doFindTextDialog, initCursorManager, initOverlayClass, script_bottomOfDocument, script_copyToClipboard, script_endOfLine, script_find, script_findNext, script_findPrevious, script_moveByCharacter_back, script_moveByCharacter_forward, script_moveByLine_back, script_moveByLine_forward, script_moveByPage_back, script_moveByPage_forward, script_moveByParagraph_back, script_moveByParagraph_forward, script_moveByWord_back, script_moveByWord_forward, script_selectAll, script_selectCharacter_back, script_selectCharacter_forward, script_selectLine_back, script_selectLine_forward, script_selectPage_back, script_selectPage_forward, script_selectParagraph_back, script_selectParagraph_forward, script_selectToBeginningOfLine, script_selectToBottomOfDocument, script_selectToEndOfLine, script_selectToTopOfDocument, script_selectWord_back, script_selectWord_forward, script_startOfLine, script_topOfDocument

Inherited from cursorManager.CursorManager (private): _caretMovementScriptHelper, _get_selection, _selectionMovementScriptHelper

Inherited from treeInterceptorHandler.TreeInterceptor: __contains__

Inherited from treeInterceptorHandler.TreeInterceptor (private): _get_isAlive, _get_passThrough, _set_passThrough

Inherited from baseObject.ScriptableObject: bindGesture, bindGestures, clearGestureBindings, getScript

Inherited from baseObject.AutoPropertyObject: invalidateCache

Inherited from baseObject.AutoPropertyObject (private): _getPropertyViaCache

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

Class Methods [hide private]
 
addQuickNav(cls, nodeType, key, nextDoc, nextError, prevDoc, prevError, readUnit=None) source code

Inherited from baseObject.AutoPropertyObject: invalidateCaches

Class Variables [hide private]
  REASON_QUICKNAV = "quickNav"
  programmaticScrollMayFireEvent = False
  APPLICATION_ROLES = controlTypes.ROLE_APPLICATION, controlType...
  NOT_LINK_BLOCK_MIN_LEN = 30
  __gestures = {"kb:enter": "activatePosition", "kb:space": "act...

Inherited from cursorManager.CursorManager (private): _lastFindText

Inherited from treeInterceptorHandler.TreeInterceptor: isReady, shouldPrepare

Inherited from treeInterceptorHandler.TreeInterceptor (private): _cache_shouldPrepare

Inherited from baseObject.AutoPropertyObject: cachePropertiesByDefault

Instance Variables [hide private]

Inherited from cursorManager.CursorManager: selection

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, rootNVDAObject, backendName=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

prepare(self)

source code 

Prepares this treeInterceptor so that it becomes ready to accept event/script input.

Overrides: treeInterceptorHandler.TreeInterceptor.prepare
(inherited documentation)

terminate(self)

source code 

Terminate this interceptor. This is called to perform any clean up when this interceptor is being destroyed.

Overrides: treeInterceptorHandler.TreeInterceptor.terminate
(inherited documentation)

getNVDAObjectFromIdentifier(self, docHandle, ID)

source code 

Retrieve an NVDAObject for a given node identifier. Subclasses must override this method.

Parameters:
  • docHandle (int) - The document handle.
  • ID (int) - The ID of the node.
Returns: NVDAObjects.NVDAObject
The NVDAObject.

getIdentifierFromNVDAObject(self, obj)

source code 

Retreaves the virtualBuffer field identifier from an NVDAObject.

Parameters:
  • obj (NVDAObject) - the NVDAObject to retreave the field identifier from.
Returns: 2-tuple.
a the field identifier as a doc handle and ID paire.

event_treeInterceptor_gainFocus(self)

source code 

Triggered when this virtual buffer gains focus. This event is only fired upon entering this buffer when it was not the current buffer before. This is different to event_gainFocus, which is fired when an object inside this buffer gains focus, even if that object is in the same buffer.

event_treeInterceptor_loseFocus(self)

source code 

Triggered when this virtual buffer loses focus. This event is only fired when the focus moves to a new object which is not within this virtual buffer; i.e. upon leaving this virtual buffer.

_activateNVDAObject(self, obj)

source code 

Activate an object in response to a user request. This should generally perform the default action or click on the object.

Parameters:

_set_selection(self, info, reason=speech.REASON_CARET)

source code 
Overrides: cursorManager.CursorManager._set_selection

_shouldSetFocusToObj(self, obj)

source code 

Determine whether an object should receive focus. Subclasses should override this method.

Parameters:

shouldPassThrough(self, obj, reason=None)

source code 

Determine whether pass through mode should be enabled or disabled for a given object.

Parameters:
  • obj (NVDAObjects.NVDAObject) - The object in question.
  • reason - The reason for this query; one of the speech reasons, REASON_QUICKNAV, or None for manual pass through mode activation by the user.
Returns:
True if pass through mode should be enabled, False if it should be disabled.

_tabOverride(self, direction)

source code 

Override the tab order if the virtual buffer caret is not within the currently focused node. This is done because many nodes are not focusable and it is thus possible for the virtual buffer caret to be unsynchronised with the focus. In this case, we want tab/shift+tab to move to the next/previous focusable node relative to the virtual buffer caret. If the virtual buffer caret is within the focused node, the tab/shift+tab key should be passed through to allow normal tab order navigation. Note that this method does not pass the key through itself if it is not overridden. This should be done by the calling script if False is returned.

Parameters:
  • direction (str) - The direction in which to move.
Returns: bool
True if the tab order was overridden, False if not.

_shouldIgnoreFocus(self, obj)

source code 

Determines whether focus on a given object should be ignored.

Parameters:
Returns: bool
True if focus on obj should be ignored, False otherwise.

_postGainFocus(self, obj)

source code 

Executed after a gainFocus within the virtual buffer. This will not be executed if event_gainFocus determined that it should abort and call nextHandler.

Parameters:

_handleScrollTo(self, obj)

source code 

Handle scrolling the buffer to a given object in response to an event. Subclasses should call this from an event which indicates that the buffer has scrolled.

Parameters:
Returns: bool
True if the buffer was scrolled, False if not.

Postcondition: The buffer caret is moved to obj and the buffer content for obj is reported.

Note: If False is returned, calling events should probably call their nextHandler.

_isNVDAObjectInApplication(self, obj)

source code 

Determine whether a given object is within an application. The object is considered to be within an application if it or one of its ancestors has an application role. This should only be called on objects beneath the buffer's root NVDAObject.

Parameters:
Returns: bool
True if obj is within an application, False otherwise.

_getInitialCaretPos(self)

source code 

Retrieve the initial position of the caret after the buffer has been loaded. This position, if any, will be passed to makeTextInfo. Subclasses should extend this method.

Returns: TextInfo position
The initial position of the caret, None if there isn't one.

_get_documentConstantIdentifier(self)

source code 

Get the constant identifier for this document. This identifier should uniquely identify all instances (not just one instance) of a document for at least the current session of the hosting application. Generally, the document URL should be used.

Returns:
The constant identifier for this document, None if there is none.

_get_shouldRememberCaretPositionAcrossLoads(self)

source code 

Specifies whether the position of the caret should be remembered when this document is loaded again. This is useful when the browser remembers the scroll position for the document, but does not communicate this information via APIs. The remembered caret position is associated with this document using documentConstantIdentifier.

Returns: bool
True if the caret position should be remembered, False if not.

Class Variable Details [hide private]

APPLICATION_ROLES

Value:
controlTypes.ROLE_APPLICATION, controlTypes.ROLE_DIALOG

__gestures

Value:
{"kb:enter": "activatePosition", "kb:space": "activatePosition", "kb:N\
VDA+f5": "refreshBuffer", "kb:NVDA+v": "toggleScreenLayout", "kb:NVDA+\
f7": "elementsList", "kb:escape": "disablePassThrough", "kb:alt+upArro\
w": "collapseOrExpandControl", "kb:alt+downArrow": "collapseOrExpandCo\
ntrol", "kb:tab": "tab", "kb:shift+tab": "shiftTab", "kb:control+alt+d\
ownArrow": "nextRow", "kb:control+alt+upArrow": "previousRow", "kb:con\
trol+alt+rightArrow": "nextColumn", "kb:control+alt+leftArrow": "previ\
ousColumn",}