Skip to content

Commit 87b7c54

Browse files
authored
Merge ba7933e into 0a704f0
2 parents 0a704f0 + ba7933e commit 87b7c54

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

source/globalCommands.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# A part of NonVisual Desktop Access (NVDA)
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
5-
# Copyright (C) 2006-2021 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee,
5+
# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee,
66
# Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Łukasz Golonka, Accessolutions,
7-
# Julien Cochuyt, Jakub Lukowicz
7+
# Julien Cochuyt, Jakub Lukowicz, Bill Dengler
88

99
import itertools
1010

@@ -2177,6 +2177,25 @@ def script_reportStatusLine(self, gesture):
21772177
else:
21782178
self.script_copyStatusLine(gesture)
21792179

2180+
@script(
2181+
description=_(
2182+
# Translators: Description for a keyboard command which reports the
2183+
# accelerator key of the currently focused object.
2184+
"Reports the shortcut key of the currently focused object.",
2185+
),
2186+
category=SCRCAT_FOCUS,
2187+
gestures=("kb:shift+numpad2", "kb(laptop):NVDA+control+shift+."),
2188+
)
2189+
def script_reportFocusObjectAccelerator(self, gesture: inputCore.InputGesture) -> None:
2190+
obj = api.getFocusObject()
2191+
if obj.keyboardShortcut:
2192+
res = obj.keyboardShortcut
2193+
else:
2194+
# Translators: reported when a user requests the accelerator key
2195+
# of the currently focused object, but there is none set.
2196+
res = _("No shortcut key")
2197+
ui.message(res)
2198+
21802199
@script(
21812200
# Translators: Input help mode message for toggle mouse tracking command.
21822201
description=_("Toggles the reporting of information as the mouse moves"),

user_docs/en/changes.t2t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ What's New in NVDA
66
= 2022.4 =
77

88
== New Features ==
9+
- Introduced a new command to check the keyboard shortcut of the current focus. (#13960)
10+
- Desktop: ``shift+numpad2``
11+
- Laptop: ``NVDA+ctrl+shift+.``
12+
-
13+
-
914

1015

1116
== Changes ==

user_docs/en/userGuide.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ There are some key commands that are useful when moving with the System focus:
318318
| 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 |
319319
| Read active window | NVDA+b | NVDA+b | reads all the controls in the currently active window (useful for dialogs) |
320320
| 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 |
321+
| Report Shortcut Key | ``shift+numpad2`` | ``NVDA+control+shift+.`` | Reports the shortcut (accelerator) key of the currently focused object. |
321322
%kc:endInclude
322323

323324
++ Navigating with the System Caret ++[SystemCaret]

0 commit comments

Comments
 (0)