From 955e6067f983457130d61c5b987c70a223c94928 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 18:00:38 -0700 Subject: [PATCH 1/8] Add new unbound script to report accelerator of current focus --- source/globalCommands.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index dffe963a5f1..fef35a697e4 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2,9 +2,9 @@ # A part of NonVisual Desktop Access (NVDA) # This file is covered by the GNU General Public License. # See the file COPYING for more details. -# Copyright (C) 2006-2021 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, +# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, # Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Łukasz Golonka, Accessolutions, -# Julien Cochuyt, Jakub Lukowicz +# Julien Cochuyt, Jakub Lukowicz, Bill Dengler import itertools @@ -2177,6 +2177,24 @@ def script_reportStatusLine(self, gesture): else: self.script_copyStatusLine(gesture) + @script( + description=_( + # Translators: Description for a keyboard command which reports the + # accelerator key of the currently focused object. + "Reports the shortcut key of the currently focused object." + ), + category=SCRCAT_FOCUS, + ) + def script_reportFocusObjectAccelerator(self, gesture): + obj = api.getFocusObject() + if obj.keyboardShortcut: + res = obj.keyboardShortcut + else: + # Translators: reported when a user requests the accelerator key + # of the currently focused object, but there is none set. + res = _("No shortcut key") + ui.message(res) + @script( # Translators: Input help mode message for toggle mouse tracking command. description=_("Toggles the reporting of information as the mouse moves"), From d57d5296aad2923361037ae62910bc456b83c15e Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 18:19:58 -0700 Subject: [PATCH 2/8] Update source/globalCommands.py Co-authored-by: Sean Budd --- source/globalCommands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index fef35a697e4..9cdb562136e 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2185,7 +2185,7 @@ def script_reportStatusLine(self, gesture): ), category=SCRCAT_FOCUS, ) - def script_reportFocusObjectAccelerator(self, gesture): + def script_reportFocusObjectAccelerator(self, gesture: "inputCore.InputGesture") -> None: obj = api.getFocusObject() if obj.keyboardShortcut: res = obj.keyboardShortcut From 4b726537e12bdd75786ba0517cc55bfeac2cbc71 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 18:21:50 -0700 Subject: [PATCH 3/8] Update source/globalCommands.py Co-authored-by: Sean Budd --- source/globalCommands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 9cdb562136e..75173e528fb 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2185,7 +2185,7 @@ def script_reportStatusLine(self, gesture): ), category=SCRCAT_FOCUS, ) - def script_reportFocusObjectAccelerator(self, gesture: "inputCore.InputGesture") -> None: + def script_reportFocusObjectAccelerator(self, gesture: inputCore.InputGesture) -> None: obj = api.getFocusObject() if obj.keyboardShortcut: res = obj.keyboardShortcut From 96f140fb36624c5ee5eed366504061dcf937b285 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 20:56:32 -0700 Subject: [PATCH 4/8] Bind the command to Shift+num5 (desktop) and Ctrl+Shift+NVDA+. (laptop) since the accelerator appears as an underlined character visually. --- source/globalCommands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 75173e528fb..88d88646dd5 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2181,9 +2181,10 @@ def script_reportStatusLine(self, gesture): description=_( # Translators: Description for a keyboard command which reports the # accelerator key of the currently focused object. - "Reports the shortcut key of the currently focused object." + "Reports the shortcut key of the currently focused object.", ), category=SCRCAT_FOCUS, + gestures=("kb:shift+numpad5", "kb(laptop):NVDA+control+shift+."), ) def script_reportFocusObjectAccelerator(self, gesture: inputCore.InputGesture) -> None: obj = api.getFocusObject() From 911f36bf14c311796ebce4410a5d63d9e06699b5 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 20:58:50 -0700 Subject: [PATCH 5/8] Oops, numpad 5 is the current word! --- source/globalCommands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 88d88646dd5..14c70c22ae5 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2184,7 +2184,7 @@ def script_reportStatusLine(self, gesture): "Reports the shortcut key of the currently focused object.", ), category=SCRCAT_FOCUS, - gestures=("kb:shift+numpad5", "kb(laptop):NVDA+control+shift+."), + gestures=("kb:shift+numpad2", "kb(laptop):NVDA+control+shift+."), ) def script_reportFocusObjectAccelerator(self, gesture: inputCore.InputGesture) -> None: obj = api.getFocusObject() From 24f498d24871cc958867fb6eea48f0dce60ba0dd Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 21:15:47 -0700 Subject: [PATCH 6/8] Update user guide --- user_docs/en/userGuide.t2t | 1 + 1 file changed, 1 insertion(+) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 5feddab123f..c079e1656d7 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -316,6 +316,7 @@ There are some key commands that are useful when moving with the System focus: | Report title | NVDA+t | NVDA+t | Reports the title of the currently active window. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | | Read active window | NVDA+b | NVDA+b | reads all the controls in the currently active window (useful for dialogs) | | Report Status Bar | NVDA+end | NVDA+shift+end | Reports the Status Bar if NVDA finds one. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | +| Report Shortcut Key | shift+numpad 2 | NVDA+control+shift+. | Reports the shortcut (accelerator) key of the currently focused object. | %kc:endInclude ++ Navigating with the System Caret ++[SystemCaret] From 8ed335eb7ea4203ea80ee3228c2b454eabcfce9f Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 27 Jul 2022 23:23:15 -0700 Subject: [PATCH 7/8] Update user_docs/en/userGuide.t2t Co-authored-by: Sean Budd --- user_docs/en/userGuide.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index c079e1656d7..c23cdf88911 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -316,7 +316,7 @@ There are some key commands that are useful when moving with the System focus: | Report title | NVDA+t | NVDA+t | Reports the title of the currently active window. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | | Read active window | NVDA+b | NVDA+b | reads all the controls in the currently active window (useful for dialogs) | | Report Status Bar | NVDA+end | NVDA+shift+end | Reports the Status Bar if NVDA finds one. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | -| Report Shortcut Key | shift+numpad 2 | NVDA+control+shift+. | Reports the shortcut (accelerator) key of the currently focused object. | +| Report Shortcut Key | ``shift+numpad2`` | ``NVDA+control+shift+.`` | Reports the shortcut (accelerator) key of the currently focused object. | %kc:endInclude ++ Navigating with the System Caret ++[SystemCaret] From ba7933e2238994d909503f23b80b9b5f94dd40ba Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Mon, 1 Aug 2022 16:43:21 +1000 Subject: [PATCH 8/8] update changes --- user_docs/en/changes.t2t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index e343f80fd67..4cac9bfcf21 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -6,6 +6,11 @@ What's New in NVDA = 2022.4 = == New Features == +- Introduced a new command to check the keyboard shortcut of the current focus. (#13960) + - Desktop: ``shift+numpad2`` + - Laptop: ``NVDA+ctrl+shift+.`` + - +- == Changes ==