NVDA Dev & Test Toolbox
- Autor: Cyrille Bougot
- Compatibilidade con NVDA: 2019.2 en diante
- Descarga versión estable
Este complemento recolle varias características para probas e depuración con NVDA.
Características
- Un diálogo de reinicio mellorado para especificar algunhas opcións adicionais ó reiniciar NVDA.
- Various features related to logged errors.
- Un explorador de propiedades de obxectos.
- Script tools: an extended script description mode and a script opener.
- Ordes para axudar á lectura e análise do rexistro.
- Backups of old logs
- No espazo de traballo da consola Python, unha función para abrir o código fonte dun obxecto.
- Un script de arranque persoalizado para a consola de Python
- Unha orde para rexistrar o seguimento de pila (stack trace) da función speech,speak.
- A command to reverse translate the items of the interface.
Commands
This add-on uses layered commands for all of the new commands it adds. The
entry point for these commands is NVDA+X
; thus all the commands should be
executed by NVDA+X
followed by another single letter or gesture. You can
list all the available layered commands pressing NVDA+X, H
.
For the commands that you use more frequently, you can also define a direct gesture in the input gesture dialog.
Diálogo de reinicio mellorado
The NVDA+X, Q
command opens a dialog to specify some extra options before
restarting NVDA. The options that can be specified correspond to the
command line options that can be used with nvda.exe
, e.g. -c
for
config path, --disable-addons
to disable add-ons, etc.
Features related to logged errors
Report last logged error
Pressing NVDA+X, E
allows to report the last error logged without needing
to open the log. A second press clears the memorized last error.
Reproducir un son para erros rexistrados
A opción "Reproducir un son para erros rexistrados" introduciuse en NVDA 2021.3 e permite especificar se NVDA reproducirá un son de erro no caso de que se rexistre un erro.
This add-on provides an additional command (NVDA+X, shift+E
) to toggle
this setting. You can choose:
- "Só en versións de proba" (por defecto) para facer a NVDA reproducir sons de erro só se a versión actual de NVDA é unha versión de proba (alfa, beta ou execución dende o código fonte).
- "Yes" to enable error sounds no matter your current NVDA version.
Para NVDA anterior á 2021.3, este complemento proporciona a retroportación desta característica e a posibilidade de controlala coa orde de teclas. A caixa de verificación no panel de opcións avanzadas non se retroportou, sen embargo.
Explorador de propiedades de obxectos
Esta característica permite anunciar algunhas propiedades do obxecto actual no navegador sen abrir o visualizador do rexistro.
Para listar as propiedades dun obxecto, move o navegador de obxectos a él e utiliza os seguintes atallos:
NVDA+X, upArrow
: Selects the previous property and reports it for the navigator object.NVDA+X, downArrow
: Selects the next property and reports it for the navigator object.NVDA+X, N
: Reports the currently selected property for the navigator objectNVDA+X, shift+N
: Displays the currently selected property for the navigator object in a browseable message
A lista de propiedades soportadas é a seguinte: name, role, state, value, windowClassName, windowControlID, windowHandle, location, Python class, Python class mro.
When using object navigation commands, you can also choose to have the
currently selected property reported instead of NVDA usual object
reporting. A toggle command, NVDA+X, control+N
, allows to switch between
this custom reporting of objects and NVDA usual reporting.
For exemple, you may select "windowClassName" property and enable custom object reporting. Then when moving the navigator object to next or previous object, you will hear the object's windowClassName instead of usual reporting.
Script tools
The script opener
The script opener command allows to open the code of a script knowing its gesture.
To use it press NVDA+x, C
and then the gesture of the script which you
want to see the code of. For example to see the code of the script that
reports the title of the foreground window, press NVDA+X, C
and then
NVDA+T
.
For this feature to work, you need to have configured your favorite editor's command in the add-on's settings. If you are not running NVDA from source, the location of NVDA source code should also have been configured.
Modo extendido de descrición de scripts
The extended script description mode allows to have reported information on scripts without description in input help mode.
When the Extended script description mode is active, the input help mode
(NVDA+1) is modified as follows. If a script has no description, the
script's name and class are reported. If a script has a description, its
description is reported as usual. The gesture to activate or deactivate
this feature is NVDA+X, D
.
Executar un xesto vinculado a un script sen descrición no modo de axuda de entrada tamén crea unha entrada para este script no diálogo de administración de xestos. Esta entrada ubícase nunha categoría dedicada chamada "Scripts without description (modify at your own risk!)" (Scripts sen descrición, modifícaos baixo a túa responsabilidade). Isto permite engadir, eliminar ou modificar os xestos nativos de NVDA para estes scripts. Ten en conta, con todo, que ás veces a intención é que eses scripts non teñan descrición para previr ao usuario de modificar o xestos asociado. De feito, o xesto podería estar definido para coincidir cunha tecla de atallo dunha aplicación. Por exemplo o script script_toggleItalic on NVDAObjects.window.winword.WordDocument está vinculado con control+I e isto non debe cambiarse xa que o atallo pásase á aplicación para executar realmente a tecla rápida.
Exemplo de uso
Control+shift+I tamén alterna a cursiva en Word, aínda que non se anuncie de forma nativa por NVDA. Para que NVDA anuncie o resultado de control+shift+I como control+I, debes realizar os pasos seguintes:
- Abre un documento de Word.
- Enable the extended script description mode with
NVDA+X, D
. - Entra no modo de axuda de entrada con NVDA+1.
- Preme control+I para anunciar o script de cursiva e que se engada ó diálogo de xestos.
- Sal do modo de axuda de entrada con NVDA+1.
- Abre o diálogo Xestos de Entrada do NVDA.
- Na categoría "Scripts without description (modify at your own risk!)" (Scripts sen descrición, modifícaos baixo a túa responsabilidade!), selecciona a orde "toggleItalic on NVDAObjects.window.winword.WordDocument".
- Engade o atallo control+shift+I e acepta.
- If you want, exit the extended script description mode with
NVDA+X, D
.
Erro coñecido: Un script engadido para unha clase en concreto é visible aínda que o administrador de xestos se abra noutro contexto.
Log reading and analyzing features
Place markers in the log
While testing or working, you may want to mark a specific moment in the log, so that you can turn to it easily later when reading the log.
To add a marker message in the log, press NVDA+X, K
.
A message as follows will be logged at INFO level:
-- NDTT marker 0 --
You can add as many markers as you want in the log. The marker's number
will be incremented each time you place a marker in the log; it will only be
reset when NVDA is restarted.
Log reader mode
A log reader mode provides commands to ease log reading and analyzing. In
the log viewer window the log reader is enabled by default, thus log reading
commands are available immediately. In another text reading area such as an
editor (e.g. Notepad++) or a webpage (e.g. GitHub issue), you need to press
NVDA+X, L
to enable log reader mode and use its commands. When you are
done with log reading and analyzing tasks, you can disable again NVDA+X, L
to disable the log reader mode.
A continuación descríbense as ordes dispoñibles no modo de lector do rexistro.
Atallos de navegación rápida
Ordes dunha soa letra similares ás teclas de navegación rápida do modo exploración permiten moverse a varios tipos de mensaxes do rexistro:
- m: calquera mensaxe
- e: error messages (
ERROR
andCRITICAL
) - w: warning messages (
WARNING
) - f: info messages (
INFO
) - k: markers previously placed in the log
- g: debug warning messages (
DEBUGWARNING
) - i: input/output messages (
IO
) - n: input messages
- s: speech messages
- d: debug messages (
DEBUG
)
Premendo a letra móvese á seguinte ocorrencia da mensaxe correspondente. Combinando a letra coa tecla shift móvese á ocorrencia anterior desta mensaxe.
Translation of speech message
Sometimes, you may have to look at a log taken on a system in a foreignh language that you do not understand. E.g. the log was taken on a Chinese system / NVDA, whereas you only understand French. If you have Instant Translate add-on installed, you may use it in conjonction with quick log navigation commands to have speech messages translated.
- First configure Instant Translate's languages. The source language should be the language of the system where the log has been taken (e.g. Chinese). The target language should be your language (e.g. French).
- Open the log
- Press T to enable automatic speech translation in the log
- Use Quick navigation commands in the log, e.g. S, I, etc. Whenever a speech message is encountered, it will be spoken in your language (French in our previous example)
If you want to disable speech translation, press T again.
Open the file of the source code in your editor
No rexistro algunha liña pode remitir ó código fonte:
- Unha liña dun seguimento de pila (traceback) contén a ruta e a liña nun
arquivo, p.ex.:
File "virtualBuffers\__init__.pyc", line 226, in _getStoryLength
- The header line of a logged message contains the function which has logged
this message, e.g.:
INFO - config.ConfigManager._loadConfig (22:45:26.145) - MainThread (16580):
- The content of a message logged in input help mode (logged at info level):
Input help: gesture kb(desktop):NVDA+t, bound to script title on globalCommands.GlobalCommands
Poderías querer abrir o arquivo que contén este código para entender o contexto do seguimento de pila (traceback) ou a mensaxe rexistrada. Simplemente preme C para abrir este arquivo.
For this feature to work, you need to have configured your favorite editor's command in the add-on's settings. If you are not running NVDA from source and want to open NVDA's code, the location of NVDA source code should also have been configured.
Backup of old logs
NVDA already provides a backup of the log of the previous session of NVDA;
the file is called nvda-old.log
. Sometimes however you may want to access
older logs, e.g. because you have had to restart NVDA again before looking
at nvda-old.log
. This add-on allows you to configure if you want to
backup old logs and how many of them; this is done in the add-on's
settings.
A log manager dialog allows to view the backed up logs. It can be opened going to NVDA menu -> Tools -> Logs manager In this dialog, you can see the list of all the backup logs and perform various actions on the selected log:
- open it (press
Enter
) - delete it (press
Delete
) - copy the log file (press
control+C
)
You can also select multiple logs to perform an actions on all of them.
To be able to open a log, you should first have configured the Command to open a file in your favorite editor.
Extensión da consola Python
Función openCodeFile
Na consola, podes chamar á función seguinte para ver o código fonte que define a variable aMinhaVar
:
openCodeFile(myVar)
For this feature to work, you need to have configured your favorite editor's command in the add-on's settings. If you are not running NVDA from source and want to open NVDA's code, the location of NVDA source code should also have been configured.
As funcións openCodeFile
poden chamarse para obxectos definidos no código
de NVDA ou para obxectos definidos por complementos. Non pode chamarse para
obxectos cuxo código fonte non está dispoñible como os integrados de Python.
Se aínda non importaches o obxecto na consola, tamén podes pasar o seu nome
como parámetro á función openCodeFile
.
Aquí hai exemplos de chamada no código de NVDA:
- Ver a definición da función
speech.speech.speak
:openCodeFile(speech.speech.speak)
ou co nome pasado como un parámetro:openCodeFile("speech.speech.speak")
- View the definition of the class
TextInfo
:openCodeFile(textInfos.TextInfo)
- View the definition of the method
copyToClipboard
of the classTextInfo
:openCodeFile(textInfos.TextInfo.copyToClipboard)
- View the definition of the class of the focused object:
openCodeFile(focus)
- Open the file
api.py
defining the moduleapi
:openCodeFile(api)
Script de arranque da consola Python
Podes definir un script persoalizado que se executará no espazo de nomes da consola Python cando se abra por primeira vez, ou se se recarga o complemento (NVDA+F3) unha vez a consola xa foi aberta.
Por exemplo, o script permíteche executar novos imports e definir alias que poderás utilizar directamente na consola, como se amosa a continuación:
# Various import that I want in the console.
import globalVars as gv
import core
import ui
# Aliases
ocf = openCodeFile
O script para a consola Python débese gardar na seguinte localización: rutaÁConfiguraciónDeNVDA\ndtt\consoleStartup.py
Por exemplo:
C:\Users\oMeuNomeDeUsuario\AppData\Roaming\nvda\ndtt\consoleStartup.py
Rexistrar o stack trace da función de fala
Sometimes, you may want to see which part of the code is responsible for
speaking something. For this, you can enable the stack trace logging of the
speech function pressing NVDA+X, S
. Each time NVDA speaks, a
corresponding stack trace will be logged in the log.
Nota: Poderías modificar directamente o arquivo do script para parchear outra función. Consulta todas as instrucións no arquivo para detalles de utilización.
Reverse translation command
Many testers use NVDA in another language than English. But when reporting test results on GitHub, the description of the modified options or the messages reported by NVDA should be written in English. Its quite frustrating and time consuming to have to restart NVDA in English to check the exact wording of the options or messages.
To avoid this, the add-on provides a reverse translation command, NVDA+X,
R
allowing to reverse translate NVDA's interface such as messages, control
labels in the GUI, etc. This command uses NVDA's gettext translation to try
to reverse translate the last speech. More specifically, the first string
of the last speech sequence is reverse translated.
For example, in French NVDA, if I arrow down to the Tools menu named "Outils", NVDA will say "Outils sous-Menu o" which stands for "Tools subMenu o". If I press the reverse translation command just after that, NVDA will reverse translate "Outils" to "Tools".
Looking at the log afterwards, we can find the following lines:
IO - speech.speech.speak (23:38:24.450) - MainThread (2044):
Speaking ['Outils', 'sous-Menu', CharacterModeCommand(True), 'o', CharacterModeCommand(False), CancellableSpeech (still valid)]
This confirms that "Outils was the first string in the speech sequence.
In case the reverse translation leads to two or more possible results, a context menu is opened listing all the possibilities.
The result of the reverse translation is also copied to the clipboard if the corresponding option is enabled, which is the default value.
Settings
Some features of the add-on may require a specific configuration. A settings panel allows to enable them or to control how they work. To view and modify these settings, go to NVDA menu -> Preferences and select the category NVDA Dev & Test Toolbox. This settings dialog can also be accessed directly from the Logs Manager dialog.
These settings are global and can only be configured when the default profile is active.
Command to open a file in your favorite editor
Some features allow to see content in your favorite editor. This includes the commands to view the source file from a log or from an object in the console as well as the log manager's Open button.
To use them, you first need to configure the command that will be called to open the file in your favorite editor.
The command should be of the form:
"C:\path\to\my\editor\editor.exe" "{path}":{line}
You should of course modify this line according to the real name and location of your editor and the syntax used by it to open files.
{path}
will be replaced by the full path of the file to open and {line}
by the line number where you want the cursor to be set.
For Notepad++ for example the command to type in the console would be:
"C:\Program Files\Notepad++\notepad++.exe" "{path}" -n{line}
NVDA source code path
When using a command to view the source file from a log or from an object in the console, the file may belong to NVDA itself.
If you are not running NVDA from source, your NVDA only contains compiled files.
Thus you may specify here an alternate location where the corresponding source file will be found, e.g. the place where you have cloned NVDA source files, so that a source file can be opened anyway.
The path should be such as:
C:\pathExample\GIT\nvda\source
Of course, replace the path of NVDA source with the correct one.
Asegúrate porén de que a versión do teu arquivo fonte (p.ex. commit GIT) é a mesma que a da copia en execución de NVDA.
Backup of old logs
The combobox Backup of old logs allows to enable or disable the feature. If it is enabled, you can also specify below in "Limit the number of backups" the maximum number of backups you want to keep. These settings only take effect at next NVDA startup when the backup takes place.
Copy reverse translation to clipboard
This option allows to choose if the reverse translation command also copies its result to the clipboard.
Rexistro de trocos
Version 7.0
- Layered commands have been introduced; the entry point is
NVDA+X
. The existing commands have been modified accordingly. - A new command (
NVDA+X, R
) to reverse translate the last spoken message. - A new command (
NVDA+X, C
) to open the source code of the script associated to the next pressed gesture. - Added speech on demand support.
- The log manager now allows more actions, either with the dedicated buttons
in the dialogs or using keyboard shortcuts in the list:
enter
to open the log,control+C
to copy the log file anddelete
to delete a log file. - The sorting order in the log manager has been reversed (most recent log on top).
- Fixed an issue when trying to open a Python module with openCodeFile function.
Version 6.3
- Compatibility with NVDA 2024.1.
Version 6.2
- Restores console opening for NVDA < 2021.1.
- Addresses potential security issues related to GHSA-xg6w-23rw-39r8 when using the add-on with older versions of NVDA. However, it is recommended to use NVDA 2023.3.3 or higher.
Version 6.1
- Opening the source file of an object located in the submodule of a package is now working.
- Bugfix: The enhanced exit dialog can now be reopened and used as expected after having been closed. (contribution from Łukasz Golonka)
Version 6.0
- While using object navigation commands, a specific object property can be reported instead of NVDA usual object reporting.
- In log reading mode, the "C" key to open a code file from the log now also works on an input help message.
- Bugfix: The add-on can now start successfully when the number of logs to save is set to its maximum value.
- Bugfix: Python console startup script's output does not prevent anymore to jump to the first result in the console when using result navigation commands.
- Note: From now on, localization updates will not appear anymore in the change log.
Version 5.0
- If Instant Translate add-on is installed, it is now possible to have speech messages translated on the fly when using log reading commands.
- While in log reading mode, pressing E or shift+E now jumps to CRITICAL erorr messages as well as normal ERROR messages.
- New log quick navigation commands have been added to jump to input and to speech messages.
- A new command allow to place a marker in the log; and specific quick navigation commands in log reading mode allow to jump to them. Credit: the initial idea for this feature comes from Debug Helper add-on by Luke Davis.
- Bubfix: The memorization of the last error do not fail anymore in some cases.
- Bugfix: The add-on can initialize again with NVDA 2019.2.1.
- Bugfix: Log saving feature will not fail anymore with non-ASCII logs.
Version 4.2
- Fixed an error with NVDA version below 2021.3.
- Fixed the stack trace log formatting.
- First localizations.
Version 4.1
- Fixed a bug occurring in some situations while logging an error.
- The add-on's settings can now be modified only when the default profile is active to avoid config issues.
Version 4.0
- Possibility to back up old logs and introduction of a logs manager.
- Added a script to report the last logged error.
- Fixed a bug preventing last log message to be read in older NVDA versions.
Version 3.2
- Compatibility with NVDA 2023.1.
Version 3.1
- Fixed an error occurring when requesting unavailable information on an object.
Configuración da ruta do código fonte de NVDA
- Nun rexistro, agora podes premer C na liña de encabezamento dunha mensaxe para abrir a función/módulo que a emitiu.
- Na consola, a función
openCodeFile
agora pode recibir como parámetro o obxecto ou unha cadea que conteña o seu nome. - Se non estás a executar NVDA dende o código fonte, poderías especificar unha ubicación alternativa onde se atoparía o arquivo fonte, p.ex. o lugar onde clonaches os arquivos da fonte de NVDA. Se éste é o caso, tes que configurar a ruta onde tes ubicados os arquivos da fonte de NVDA.
- Varios arranxos menores para a función da consola de Python
openCodeFile
e a orde para abrir o arquivo fonte correspondente cunha liña no rexistro. - Arranxado un problema ao tratar de reportar roles/estados no explorador de obxectos en versións antigas de NVDA.
- Asegúrate, iso si, que a versión do teu arquivo fonte (p.ex. commit de GIT) é a mesma que a da instancia en execución de NVDA.
Versión 2.1
- Various bugfixes and code refactoring/cleaning to address all use cases: all supported versions, installed vs. run from source, etc. (contribution from Łukasz Golonka)
- Rewriting of the compa module (contribution from Łukasz Golonka)
- O diálogo de reiniciar agora só se pode abrir unha vez.
- Os atallos do explorador de obxectos están agora sen asignar por defecto e teñen que ser mapeados polo usuario.
- Co explorador de obxectos, unha doble pulsación para chamar ó script para anunciar as propiedades do obxecto actual agora amosa a información anunciada nunha mensaxe navegable.
Versión 2.0
- Nova característica: Diálogo de reinicio mellorado para especificar algunhas opcións extra ao reiniciar NVDA.
- Nova característica: modo de descricións extendidas.
- Armonizada a característica reproducir son de erro entre as versións de NVDA anteriores e posteriores á 2021.3.
- Nova característica: Os atallos do lector do rexistro están dispoñibles no visualizador do rexistro e tamén opcionalmente en campos de edición e páxinas web.
- Nova caracteríastica: Na consola Python, está dispoñible unha función
openCodeFile
para ver o código fonte dun obxecto. - Algunhas características agora están deshabilitadas no modo seguro por razóns de seguridade.
- Estendeuse o rango de compatibilidade do complemento (dende 2019.2 ata 2021.1).
- As publicacións realízanse agora cunha acción de gitHub no canto de AppVeyor.
Versión 1.0
- Versión inicial.
https://www.nvaccess.org/files/nvda/documentation/userGuide.html#CommandLineOptions
https://www.nvaccess.org/files/nvda/documentation/userGuide.html#PlayErrorSound
https://github.com/nvaccess/nvda/security/advisories/GHSA-xg6w-23rw-39r8#event-132994