treeInterceptorHandler module
- treeInterceptorHandler.post_browseModeStateChange = <extensionPoints.Action object>
Notifies when browse mode state has changed. This allows components and add-ons to perform an action. For example, an add-on may activate a profile when browse mode has been activated, and deactivate that profile when browse mode becomes inactive. @param browseMode: The state of browse mode. @type browseMode: bool
- treeInterceptorHandler.getTreeInterceptor(obj)
- treeInterceptorHandler.update(obj, force=False)
- treeInterceptorHandler.cleanup()
Kills off any treeInterceptors that are no longer alive.
- treeInterceptorHandler.killTreeInterceptor(treeInterceptorObject)
- treeInterceptorHandler.terminate()
Kills any currently running treeInterceptors
- class treeInterceptorHandler.TreeInterceptor(*args, **kwargs)
Bases:
ScriptableObject
Intercepts events and scripts for a tree of NVDAObjects. When an NVDAObject is encompassed by this interceptor (i.e. it is beneath the root object or it is the root object itself), events will first be executed on this interceptor if implemented. Similarly, scripts on this interceptor take precedence over those of encompassed objects.
- shouldTrapNonCommandGestures = False
If true then gestures that do not have a script and are not a command gesture should be trapped from going through to Windows.
- rootNVDAObject: NVDAObjects.NVDAObject
The root object of the tree wherein events and scripts are intercepted.
- terminate()
Terminate this interceptor. This is called to perform any clean up when this interceptor is being destroyed.
- _get_isAlive()
Whether this interceptor is alive. If it is not alive, it will be removed.
- isReady = True
Whether this interceptor is ready to be used; i.e. whether it should receive scripts and events. @type: bool
- property passThrough
Whether most scripts should temporarily pass through this interceptor without being intercepted.
- _get_passThrough()
Whether most scripts should temporarily pass through this interceptor without being intercepted.
- _set_passThrough(state)
- _cache_shouldPrepare = True
- shouldPrepare = False
True if this treeInterceptor’s prepare method should be called in order to make it ready (e.g. load a virtualBuffer, or process the document in some way).
- prepare()
Prepares this treeInterceptor so that it becomes ready to accept event/script input.
- _abc_impl = <_abc._abc_data object>
- isAlive
- class treeInterceptorHandler.DocumentTreeInterceptor(*args, **kwargs)
Bases:
TextContainerObject
,TreeInterceptor
A TreeInterceptor that supports document review.
- isTextSelectionAnchoredAtStart = True
Indicates if the text selection is anchored at the start. The anchored position is the end that doesn’t move when extending or shrinking the selection. For example, if you have no selection and you press shift+rightArrow to select the next character, this will be True. In contrast, if you have no selection and you press shift+leftArrow to select the previous character, this will be False. If the selection is anchored at the end or there is no information this is C{False}. @type: bool
- _abc_impl = <_abc._abc_data object>
- class treeInterceptorHandler.RootProxyTextInfo(*args, **kwargs)
Bases:
TextInfo
Constructor. Subclasses must extend this, calling the superclass method first. @param position: The initial position of this range; one of the POSITION_* constants or a position object supported by the implementation. @param obj: The object containing the range of text being represented.
- _get_InnerTextInfoClass()
- copy()
duplicates this text info object so that changes can be made to either one with out afecting the other
- _get__rangeObj()
- _set__rangeObj(r)
- _get_locationText()
A message that explains the location of the text position in friendly terms.
- copyToClipboard(notify=False)
Copy the content of this instance to the clipboard. @return: C{True} if successful, C{False} otherwise. @rtype: bool @param notify: whether to emit a confirmation message @type notify: boolean
- find(text, caseSensitive=False, reverse=False)
Locates the given text and positions this TextInfo object at the start. @param text: the text to search for @type text: string @param caceSensitive: true if case sensitivity search should be used, False if not @type caseSensitive: bool @param reverse: true then the search will go from current position towards the start of the text, if false then towards the end. @type reverse: bool @returns: True if text is found, false otherwise @rtype: bool
- activate()
Activate this position. For example, this might activate the object at this position or click the point at this position. @raise NotImplementedError: If not supported.
- compareEndPoints(other, which)
compares one end of this range to one end of another range. Subclasses must implement this. @param other: the text range to compare with. @type other: L{TextInfo} @param which: The ends to compare; one of “startToStart”, “startToEnd”, “endToStart”, “endToEnd”. @return: -1 if this end is before other end, 1 if this end is after other end or 0 if this end and other end are the same. @rtype: int
- setEndPoint(other, which)
Sets one end of this range to one end of another range. Subclasses must implement this. @param other: The range from which an end is being obtained. @type other: L{TextInfo} @param which: The ends to use; one of “startToStart”, “startToEnd”, “endToStart”, “endToEnd”.
- _get_isCollapsed()
@return: C{True} if representing a collapsed range, C{False} if the range is expanded to cover one or more characters. @rtype: bool
- collapse(end=False)
Collapses this text info object so that both endpoints are the same. @param end: Whether to collapse to the end; C{True} to collapse to the end, C{False} to collapse to the start. @type end: bool
- move(unit, direction, endPoint=None)
Moves one or both of the endpoints of this object by the given unit and direction. @param unit: the unit to move by; one of the UNIT_* constants. @param direction: a positive value moves forward by a number of units, a negative value moves back a number of units @type: int @param endPoint: Either None, “start” or “end”. If “start” then the start of the range is moved, if “end” then the end of the range is moved, if None - not specified then collapse to start and move both start and end. @return: The number of units moved;
negative indicates backward movement, positive indicates forward movement, 0 means no movement.
@rtype: int
- _get_bookmark()
- updateCaret()
Moves the system caret to the position of this text info object
- updateSelection()
Moves the selection (usually the system caret) to the position of this text info object
- _get_text()
The text with in this range. Subclasses must implement this. @return: The text. @note: The text is not guaranteed to be the exact length of the range in offsets.
- _get_boundingRects()
Per line bounding rectangles for the visible text in this range. Implementations should ensure that the bounding rectangles don’t contain off screen coordinates. @rtype: [L{locationHelper.RectLTWH}] @raise NotImplementedError: If not supported. @raise LookupError: If not available (i.e. off screen, hidden, etc.)
- getTextWithFields(formatConfig: Dict | None = None) List[str | FieldCommand]
Retrieves the text in this range, as well as any control/format fields associated therewith. Subclasses may override this. The base implementation just returns the text. @param formatConfig: Document formatting configuration, useful if you wish to force a particular
configuration for a particular task.
@return: A sequence of text strings interspersed with associated field commands.
- expand(unit)
Expands the start and end of this text info object to a given unit @param unit: a unit constant @type unit: string
- getMathMl(field)
Get MathML for a math control field. This will only be called for control fields with a role of L{controlTypes.Role.MATH}. @raise LookupError: If MathML can’t be retrieved for this field.
- _get_NVDAObjectAtStart()
Get the NVDAObject related to the start of the range. Usually it is just the owner NVDAObject, but in the case of virtualBuffers it may be a descendant object. @returns: the NVDAObject at the start
- _get_focusableNVDAObjectAtStart()
retreaves the deepest focusable NVDAObject related to the start of the range. Usually it is just the owner NVDAObject, but in the case of virtualBuffers it may be a descendant object. @returns: the NVDAObject at the start
- getFormatFieldSpeech(attrs: Field, attrsCache: Field | None = None, formatConfig: Dict[str, bool] | None = None, reason: OutputReason | None = None, unit: str | None = None, extraDetail: bool = False, initialFormat: bool = False) list[SpeechCommand | str]
Get the spoken representation for given format information. The base implementation just calls L{speech.getFormatFieldSpeech}. This can be extended in order to support implementation specific attributes. If extended, the superclass should be called first.
- _get_pointAtStart()
Retrieves x and y coordinates corresponding with the textInfo start. It should return Point. The base implementation uses L{boundingRects}. @rtype: L{locationHelper.Point}
- InnerTextInfoClass
- NVDAObjectAtStart: NVDAObjects.NVDAObject
Typing information for auto-property: _get_NVDAObjectAtStart
- _abc_impl = <_abc._abc_data object>
- property _rangeObj
- bookmark
- boundingRects
- focusableNVDAObjectAtStart
- isCollapsed
- locationText
- pointAtStart
- text: str
Typing information for auto-property: _get_text