Module api
[hide private]

Module api

source code

General functions for NVDA

Functions [hide private]
NVDAObjects.NVDAObject
getFocusObject()
Gets the current object with focus.
source code
NVDAObjects.NVDAObject
getForegroundObject()
Gets the current foreground object.
source code
 
setForegroundObject(obj)
Stores the given object as the current foreground object.
source code
 
setFocusObject(obj)
Stores an object as the current focus object.
source code
 
getFocusDifferenceLevel() source code
 
getFocusAncestors()
An array of NVDAObjects that are all parents of the object which currently has focus
source code
 
getMouseObject()
Returns the object that is directly under the mouse
source code
 
setMouseObject(obj)
Tells NVDA to remember the given object as the object that is directly under the mouse
source code
 
getDesktopObject()
Get the desktop object
source code
 
setDesktopObject(obj)
Tells NVDA to remember the given object as the desktop object
source code
 
getReviewPosition()
Retreaves the current TextInfo instance representing the user's review position.
source code
 
setReviewPosition(reviewPosition, clearNavigatorObject=True, isCaret=False)
Sets a TextInfo instance as the review position.
source code
NVDAObjects.NVDAObject
getNavigatorObject()
Gets the current navigator object.
source code
 
setNavigatorObject(obj, isFocus=False)
Sets an object to be the current navigator object.
source code
boolean
isTypingProtected()
Checks to see if key echo should be suppressed because the focus is currently on an object that has its protected state set.
source code
 
createStateList(states)
Breaks down the given integer in to a list of numbers that are 2 to the power of their position.
source code
 
moveMouseToNVDAObject(obj)
Moves the mouse to the given NVDA object's position
source code
 
processPendingEvents(processEventQueue=True) source code
boolean
copyToClip(text)
Copies the given text to the windows clipboard.
source code
string
getClipData()
Receives text from the windows clipboard.
source code
NVDAObjects.NVDAObject
getStatusBar()
Obtain the status bar for the current foreground object.
source code
str
getStatusBarText(obj)
Get the text from a status bar.
source code
str
filterFileName(name)
Replaces invalid characters in a given string to make a windows compatible file name.
source code
baseObject.ScriptableObject
getCaretObject()
Gets the object which contains the caret.
source code
Function Details [hide private]

getFocusObject()

source code 

Gets the current object with focus.

Returns: NVDAObjects.NVDAObject
the object with focus

getForegroundObject()

source code 

Gets the current foreground object.

Returns: NVDAObjects.NVDAObject
the current foreground object

setForegroundObject(obj)

source code 

Stores the given object as the current foreground object. (Note: it does not physically change the operating system foreground window, but only allows NVDA to keep track of what it is).

Parameters:
  • obj (NVDAObjects.NVDAObject) - the object that will be stored as the current foreground object

setFocusObject(obj)

source code 

Stores an object as the current focus object. (Note: this does not physically change the window with focus in the operating system, but allows NVDA to keep track of the correct object). Before overriding the last object, this function calls event_loseFocus on the object to notify it that it is loosing focus.

Parameters:
  • obj (NVDAObjects.NVDAObject) - the object that will be stored as the focus object

getReviewPosition()

source code 

Retreaves the current TextInfo instance representing the user's review position. If it is not set, it uses the user's set navigator object and creates a TextInfo from that.

setReviewPosition(reviewPosition, clearNavigatorObject=True, isCaret=False)

source code 

Sets a TextInfo instance as the review position.

Parameters:
  • clearNavigatorObject (bool) - if true, It sets the current navigator object to None. In that case, the next time the navigator object is asked for it fetches it from the review position.
  • isCaret (bool) - Whether the review position is changed due to caret following.

getNavigatorObject()

source code 

Gets the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. If the navigator object is not set, it fetches it from the review position.

Returns: NVDAObjects.NVDAObject
the current navigator object

setNavigatorObject(obj, isFocus=False)

source code 

Sets an object to be the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. It also sets the current review position to None so that next time the review position is asked for, it is created from the navigator object.

Parameters:
  • obj (NVDAObjects.NVDAObject) - the object that will be set as the current navigator object
  • isFocus (bool) - true if the navigator object was set due to a focus change.

isTypingProtected()

source code 

Checks to see if key echo should be suppressed because the focus is currently on an object that has its protected state set.

Returns: boolean
True if it should be suppressed, False otherwise.

copyToClip(text)

source code 

Copies the given text to the windows clipboard.

Parameters:
  • text (string) - the text which will be copied to the clipboard
Returns: boolean
True if it succeeds, False otherwise.

getClipData()

source code 

Receives text from the windows clipboard.

Returns: string
Clipboard text

getStatusBar()

source code 

Obtain the status bar for the current foreground object.

Returns: NVDAObjects.NVDAObject
The status bar object or None if no status bar was found.

getStatusBarText(obj)

source code 

Get the text from a status bar. This includes the name of the status bar and the names and values of all of its children.

Parameters:
Returns: str
The status bar text.

filterFileName(name)

source code 

Replaces invalid characters in a given string to make a windows compatible file name.

Parameters:
  • name (str) - The file name to filter.
Returns: str
The filtered file name.

getCaretObject()

source code 

Gets the object which contains the caret. This is normally the focus object. However, if the focus object has a tree interceptor which is not in focus mode, the tree interceptor will be returned.

Returns: baseObject.ScriptableObject
The object containing the caret.