NVDA Dev & Test Toolbox
- 作者: Cyrille Bougot
- NVDA 互換性: 2019.2 以降
- ダウンロード 安定版
このアドオンは、NVDAデバッグとテストのための様々な機能を集めています。
機能
- NVDAの再起動時に、追加のオプションを特定する拡張再起動ダイアログ。
- Various features related to logged errors.
- オブジェクトプロパティエクスプローラ。
- Script tools: an extended script description mode and a script opener.
- ログリーディングと解析を助けるコマンド。
- Backups of old logs
- Pythonコンソールワークスペースにて、オブジェクトのソースコードを開く機能。
- Pythonコンソール用のカスタム起動スクリプト
- 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.
拡張再起動ダイアログ
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.
エラーログ時に音を鳴らす
The "エラーログ時に音を鳴らす" 設定 は、NVDA 2021.3で導入され、NVDAがエラーログ時にエラー音を鳴らすかどうかを特定出来ます。
This add-on provides an additional command (NVDA+X, shift+E
) to toggle
this setting. You can choose:
- "テストバージョンのみ" (デフォルト) 現在のNVDAが、テストバージョン(アルファ、ベータ、ソースから実行)の場合にのみ、NVDAがエラー音を鳴らします。
- "Yes" to enable error sounds no matter your current NVDA version.
2021.3より前のNVDAでは、このアドオンはこの機能のバックポートを提供し、操作はキーボードコマンドで可能です。アドバンスト設定パネル内のチェックボックスは、しかしながら、バックポートされていません。
オブジェクトプロパティエクスプローラ
この機能は、ログビューアを開かなくても、現在のナビゲータオブジェクトのいくつかのプロパティを報告してくれるようになります。
オブジェクトのプロパティをリストするには、ナビゲータオブジェクトをそこに動かし、次のコマンドを使います:
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
サポートされているプロパティのリストは以下です: 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.
拡張スクリプトデスクリプションモード
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
.
入力ヘルプモードでの、デスクリプションのないスクリプトに結び付けられているジェスチャーの実行は、ジェスチャー管理ダイアログに、このスクリプトのためのエントリーもまた生成します。このエントリーは、「デスクリプションのないスクリプト(自己責任で変更して下さい!)」と呼ばれる専用のカテゴリーに位置しています。これにより、これらのスクリプトに、ネイティブなNVDAのジェスチャーを簡単に追加、削除、または変更出来るようになります。しかしながら、このようなスクリプトが何のデスクリプションも持たないのは、ユーザーが、添えられたジェスチャーを変更するのを避けることがしばしば意図されていることに気を付けて下さい。実際、ジェスチャーは、アプリケーションのショートカットキーに一致するように定義されるかもしれません。例えば、NVDAObjects.window.winword.WordDocument のスクリプト script_toggleItalic は、control+I に結び付けられており、これは変更されるべきではありません。このショートカットキーを実際に実行するために、このジェスチャーはアプリケーションに渡されるからです。
使用例
Control+shift+Iもまた、NVDAによって報告されていなくても、Wordでイタリックを切り替えます。control+Iのように、control+shift+IをNVDAが報告するようにするには、次のステップを行います:
- Wordドキュメントを開きます。
- Enable the extended script description mode with
NVDA+X, D
. - NVDA+1で入力ヘルプモードに入ります。
- control+Iを押して、イタリックスクリプトを報告するようにし、ジェスチャーダイアログに追加します。
- NVDA+1で入力ヘルプモードから出ます。
- 入力ジェスチャーダイアログを開きます。
- 「デスクリプションのないスクリプト(自己責任で変更して下さい!)」のカテゴリーで、コマンド「NVDAObjects.window.winword.WordDocumentのtoggleItalic」を選びます。
- control+shift+Iショートカットを追加して有効にします。
- If you want, exit the extended script description mode with
NVDA+X, D
.
既知のバグ: 特定のクラスに追加されたスクリプトは、ジェスチャーマネジャーが別のコンテクストで開かれていても、見えるようになります。
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.
ログリーダーモードで使用可能なコマンドは以下の通りです。
クイックナビゲーションコマンド
ブラウズモードのクイックナビゲーションキーのような、1文字コマンドで、様々なタイプのログメッセージに移動出来ます:
- m: あらゆるメッセージ
- 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
)
1文字を押すと、このメッセージの次の発生個所に移動します。shiftキーとこの文字の組み合わせでは、このメッセージの前の発生場所に移動します。
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
ログの中で、一部の行はソースコードを参照するかもしれません:
- tracebackに属する行は、ファイルのパスと行を含んでいます。例えば:
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
tracebackまたはログメッセージの内容を理解するために、このコードを含むファイルを開きたいかもしれません。このファイルを開くにはCを押して下さい。
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.
Pythonコンソール拡張
openCodeFile
機能
コンソールにて、変数myVar
を定義するソースコードを閲覧するための、次の関数を呼び出せます:
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.
openCodeFile
機能は、NVDAのコードで定義されているオブジェクト、または、アドオンで定義されているオブジェクトで呼び出すことが出来ます。ソースコードがpythonビルトインなどで利用出来ないオブジェクトでは呼び出せません。
コンソールにてオブジェクトをインポートしていない場合は、その名称をパラメータとしてopenCodeFile
機能に渡すことも出来ます。
以下は、NVDAのコードでの呼び出しの例です:
- 機能の定義を閲覧
speech.speech.speak
:openCodeFile(speech.speech.speak)
またはパラメータとして渡されたの名称と共に:
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)
Pythonコンソール拡張スクリプト
Pythonコンソールが最初に開かれた時、または、コンソールがすでに開かれていて、このアドオンが再読み込み(NVDA+F3)された場合に、Pythonコンソールの名前空間で実行されるカスタムスクリプトを定義出来ます。
例えば、スクリプトにより、次のように、コンソールで直接使用出来る新しいインポートとエイリアス定義を実行出来ます:
# コンソールで使用したい様々なインポート。
import globalVars as gv
import core
import ui
# エイリアス
ocf = openCodeFile
Pythonコンソールスクリプトは次の位置に置いて下さい: pathToNVDAConfig\ndtt\consoleStartup.py
例: C:\Users\myUserName\AppData\Roaming\nvda\ndtt\consoleStartup.py
スピーチ機能のスタックトレースを記録する
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.
備考:他の機能をパッチするために、スクリプトのファイルを直接変更することが出来ます。使用方法の詳細については、ファイル内の全てのインストラクションを見て下さい。
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
もちろん、NVDAのソースのパスは、正しいものに置き換えて下さい。
しかしながら、ソースファイル(例えばGITコミット)のバージョンが、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.
変更履歴
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.
バージョン3.0
- ログの中で、関数/モジュールを開けるようになりました。メッセージのヘッダ行でCを押して、出て来た関数/モジュールを開けるようになりました。
- コンソールで、
openCodeFile
機能がオブジェクトまたはその名前を含む文字列をパラメータとして受け取れるようになりました。 - 新機能: NVDAコンソール起動ファイル: もしあれば、ファイル YourNVDAConfigFolder\ndtt\consoleStartup.py が、NVDAコンソールが初めて開かれた時、またはアドオンが再読み込みされた時に、実行されるようになります。
openCodeFile
Pythonコンソール機能とログの中の行に対応するソースファイルを開くコマンドの様々な軽微な修正。- NVDAの古いバージョンのオブジェクトエクスプローラにroles/statesを報告しようとする場合の問題の修正。
- EdgeにてUIAを使用する時のツリーインターセプターに対して、今後はアドオンが問題の原因にならなくなりました。
バージョン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)
- 再起動ダイアログが一度だけ開くようになりました。
- オブジェクトエクスプローラショートカットがデフォルトでは割り当てられなくなり、ユーザーにより設定される必要があるようになりました。
- オブジェクトエクスプローラにて、スクリプトを呼び出して、現在のオブジェクトのプロパティを報告する2回押しで、報告される情報が閲覧可能なメッセージとして表示されるようになりました。
バージョン2.0
- 新しい機能: NVDAを再起動するときにいくつかの追加の選択肢を特定する拡張再起動ダイアログ。
- 新しい機能: 拡張デスクリプションモード。
- エラー音を鳴らす機能が、NVDAの2021.3より前と後のバージョンの間で一致しました。
- 新しい機能: ログリーダーコマンドが、ログビューアーと、選択的に、エディットフィールドまたはwebページでも使用可能になりました。
- 新しい機能: Pythonコンソールにて、オブジェクトのソースコードを閲覧するのに、
openCodeFile
関数が使用可能になりました。 - セキュリティ上の理由で、いくつかの機能がセキュアモードで使用不能になりました。
- このアドオンの互換範囲が広くなりました(2019.2から2021.1)。
- appVeyorの代わりに、GitHubアクションによって、リリースが行われるようになりました。
バージョン1.0
- 最初のリリース。
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