|
2 | 2 | # A part of NonVisual Desktop Access (NVDA) |
3 | 3 | # This file is covered by the GNU General Public License. |
4 | 4 | # 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, |
6 | 6 | # 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 |
8 | 8 |
|
9 | 9 | import itertools |
10 | 10 |
|
@@ -2177,6 +2177,25 @@ def script_reportStatusLine(self, gesture): |
2177 | 2177 | else: |
2178 | 2178 | self.script_copyStatusLine(gesture) |
2179 | 2179 |
|
| 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 | + |
2180 | 2199 | @script( |
2181 | 2200 | # Translators: Input help mode message for toggle mouse tracking command. |
2182 | 2201 | description=_("Toggles the reporting of information as the mouse moves"), |
|
0 commit comments