Skip to content

Commit

Permalink
script_togglePainting based on work by Karl-Otto Rosenqvist
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimotz committed Jul 1, 2019
1 parent 059f37c commit 063fd09
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
35 changes: 33 additions & 2 deletions addon/globalPlugins/focusHighlight.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -271,6 +279,7 @@ def getConfigARGB(category):
terminating = False
passThroughMode = config.conf['focusHighlight']['passthrough']['defaultMode']
currentAppSleepMode = False
pausePainting = False


def rectEquals(r1, r2):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Focus Highlight #

* Authors: Takuya Nishimoto
* Authors: Takuya Nishimoto, Karl-Otto Rosenqvist
* Download [stable version][2]
* Download [development version][1]

Expand All @@ -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.

Expand All @@ -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 ##

Expand Down

0 comments on commit 063fd09

Please sign in to comment.