diff --git a/addon/globalPlugins/focusHighlight.py b/addon/globalPlugins/focusHighlight.py index ddc1736..a3baf1e 100644 --- a/addon/globalPlugins/focusHighlight.py +++ b/addon/globalPlugins/focusHighlight.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # focus highlight -#Copyright (C) 2013-2019 Takuya Nishimoto +#Copyright (C) 2013-2019 Takuya Nishimoto, Karl-Otto Rosenqvist # Released under GPL 2 import os @@ -28,6 +28,14 @@ import winUser import wx from logHandler import log +try: + from scriptHandler import script +except: + def script(**kwargs): + def script_decorator(decoratedScript): + return decoratedScript + return script_decorator + from NVDAObjects import NVDAObject try: @@ -271,6 +279,7 @@ def getConfigARGB(category): terminating = False passThroughMode = config.conf['focusHighlight']['passthrough']['defaultMode'] currentAppSleepMode = False +pausePainting = False def rectEquals(r1, r2): @@ -465,9 +474,11 @@ def invalidateRects(): def updateLocations(): - global passThroughMode, currentAppSleepMode + global passThroughMode, currentAppSleepMode, pausePainting passThroughMode = isPassThroughMode() currentAppSleepMode = isCurrentAppSleepMode() + if pausePainting: + currentAppSleepMode = True updateFocusLocation() updateNavigatorLocation() invalidateRects() @@ -549,6 +560,26 @@ def startThread(): class GlobalPlugin(globalPluginHandler.GlobalPlugin): + # Translators: Input help mode message + TOGGLE_DESC = _('Toggles on and off the highlighting of focus') + + @script( + gesture="kb:NVDA+alt+p", + description=TOGGLE_DESC, + category=ADDON_SUMMARY + ) + def script_togglePainting(self, gesture): + global pausePainting + if pausePainting: + pausePainting = False + # Translators: togglePainting message + ui.message(_('{} on').format(ADDON_SUMMARY)) + else: + pausePainting = True + # Translators: togglePainting message + ui.message(_('{} off').format(ADDON_SUMMARY)) + + def __init__(self): super(globalPluginHandler.GlobalPlugin, self).__init__() if NVDASettingsDialog: diff --git a/readme.md b/readme.md index 9f49c33..5a4a529 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Focus Highlight # -* Authors: Takuya Nishimoto +* Authors: Takuya Nishimoto, Karl-Otto Rosenqvist * Download [stable version][2] * Download [development version][1] @@ -13,7 +13,9 @@ The following colors are used by this addon: * Red thick rectangle shows NVDA is in browse mode, and this is both the navigator object and the focused object which are overlapping. * Blue thick dotted line rectangle indicates NVDA is in focus mode, i.e., key types are passed to the control. -To disable object tracking, disable or uninstall the addon. +To toggle object tracking, press NVDA+Alt+P. You can assign other gestures using the Input Gestures dialog. +Note that it works with NVDA 2018.3 or later. +Otherwise, you should disable or uninstall the addon itself for disabling object tracking. When Focus Highlight category of NVDA Settings dialog is available, following items can be used. @@ -27,6 +29,7 @@ When Focus Highlight category of NVDA Settings dialog is available, following it ## Changes for 6.2 ## * New and updated translations. +* You can now turn object tracking on and off using NVDA+Alt+P. Karl-Otto Rosenqvist contributed for this. ## Changes for 6.1 ##