core module
NVDA core
- core.mainThreadId = 21404
The thread identifier of the main thread.
- class core._PumpPending(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- NONE = 0
- DELAYED = 1
- IMMEDIATE = 2
- core._showAddonsErrors() None
- core.doStartupDialogs()
- class core.NewNVDAInstance(filePath: str, parameters: str | None = None, directory: str | None = None)
Bases:
object
- filePath: str
- parameters: str | None = None
- directory: str | None = None
- core.restartUnsafely()
Start a new copy of NVDA immediately. Used as a last resort, in the event of a serious error to immediately restart NVDA without running any cleanup / exit code. There is no dependency on NVDA currently functioning correctly, which is in contrast with L{restart} which depends on the internal queue processing (queueHandler). Because none of NVDA’s shutdown code is run, NVDA is likely to be left in an unclean state. Some examples of clean up that may be skipped. - Free NVDA’s mutex (mutex prevents multiple NVDA instances), leaving it abandoned when this process ends.
However, this situation is handled during mutex acquisition.
Remove icons (systray)
Saving settings
- core.restart(disableAddons=False, debugLogging=False)
Restarts NVDA by starting a new copy.
- core.resetConfiguration(factoryDefaults=False)
Loads the configuration, installs the correct language support and initialises audio so that it will use the configured synth and speech settings.
- core._setInitialFocus()
Sets the initial focus if no focus event was received at startup.
- core.getWxLangOrNone() wx.LanguageInfo | None
- core._startNewInstance(newNVDA: NewNVDAInstance)
If something (eg the installer or exit dialog) has requested a new NVDA instance to start, start it. Should only be used by calling triggerNVDAExit and after handleNVDAModuleCleanupBeforeGUIExit and _closeAllWindows.
- core._doShutdown(newNVDA: NewNVDAInstance | None)
- core.triggerNVDAExit(newNVDA: NewNVDAInstance | None = None) bool
Used to safely exit NVDA. If a new instance is required to start after exit, queue one by specifying instance information with
newNVDA
. @return: True if this is the first call to trigger the exit, and the shutdown event was queued.
- core._closeAllWindows()
Should only be used by calling triggerNVDAExit and after _handleNVDAModuleCleanupBeforeGUIExit. Ensures the wx mainloop is exited by all the top windows being destroyed. wx objects that don’t inherit from wx.Window (eg sysTrayIcon, Menu) need to be manually destroyed.
- core._handleNVDAModuleCleanupBeforeGUIExit()
Terminates various modules that rely on the GUI. This should be used before closing all windows and terminating the GUI.
- core._initializeObjectCaches()
Caches the desktop object. This may make information from the desktop window available on the lock screen, however no known exploit is known for this.
The desktop object must be used, as setting the object caches has side effects, such as focus events. Side effects from events generated while setting these objects may require NVDA to be finished initializing. E.G. An app module for a lockScreen window. The desktop object is an NVDA object without event handlers associated with it.
- core._doLoseFocus()
- core._setUpWxApp() wx.App
- core.main()
NVDA’s core main loop. This initializes all modules such as audio, IAccessible, keyboard, mouse, and GUI. Then it initialises the wx application object and sets up the core pump, which checks the queues and executes functions when requested. Finally, it starts the wx main loop.
- core._terminate(module, name=None)
- core.isMainThread() bool
- core.requestPump(immediate: bool = False)
Request a core pump. This will perform any queued activity. @param immediate: If True, the pump will happen as soon as possible. This
should be used where response time is most important; e.g. user input or focus events. If False, it is delayed slightly so that queues can implement rate limiting, filter extraneous events, etc.
- exception core.NVDANotInitializedError
Bases:
Exception
- core.callLater(delay, callable, *args, **kwargs)
Call a callable once after the specified number of milliseconds. As the call is executed within NVDA’s core queue, it is possible that execution will take place slightly after the requested time. This function should never be used to execute code that brings up a modal UI as it will cause NVDA’s core to block. This function can be safely called from any thread once NVDA has been initialized.
- core._callLaterExec(callable, args, kwargs)