Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new script to report accelerator key of currently focused object #13960

Merged
merged 9 commits into from
Aug 2, 2022
22 changes: 20 additions & 2 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"),
Expand Down