Skip to content

Commit

Permalink
Address more review feedbacks:
Browse files Browse the repository at this point in the history
* Fix a gesture definition bug
* Add missing translator comments
* Documentation: add links to MS website, and fix other details
* Fixes missing . in translator comments and in documentation list items.
  • Loading branch information
CyrilleB79 committed Feb 18, 2020
1 parent 2b6bdcc commit bd769e0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ This addon improves the use of the Windows Magnifier with NVDA.

* Adds some keyboard shortcuts to toggle various Magnifier options.
* Reports the result of some native Magnifier keyboard commands.
* Reduces the cases where table navigation command conflict with Magnifier's commands
* Reduces the cases where table navigation command conflict with Magnifier's commands.


## Commands added by this add-on

All the commands added to control Magnifier options are accessible through the Magnifier layer command NVDA+Windows+O:

* NVDA+Windows+O then C: Toggles on or off caret tracking
* NVDA+Windows+O then F: Toggles on or off focus tracking
* NVDA+Windows+O then M: Toggles on or off mouse tracking
* NVDA+Windows+O then T: Toggles on or off tracking globally
* NVDA+Windows+O then S: Toggles on or off smoothing
* NVDA+Windows+O then C: Toggles on or off caret tracking.
* NVDA+Windows+O then F: Toggles on or off focus tracking.
* NVDA+Windows+O then M: Toggles on or off mouse tracking.
* NVDA+Windows+O then T: Toggles on or off tracking globally.
* NVDA+Windows+O then S: Toggles on or off smoothing.
* NVDA+Windows+O then R: Switch between mouse tracking modes (within the edge of the screen or centered on the screen); this feature is only available on Windows 10 build 17643 or higher.
* NVDA+Windows+O then H: Displays help on Magnifier layer commands
* NVDA+Windows+O then H: Displays help on Magnifier layer commands.

There is no default gesture for each command, but you can attribute one normally in the input gesture dialog if you wish. The same way, You can also modify or delete the Magnifier layer access gesture (NVDA+Windows+O). Yet, you cannot modify the shortcut key of the Magnifier layer sub-commands.

Expand All @@ -42,32 +42,37 @@ The result of the following Magnifier native commands is vocalized by this add-o
* Select the full screen view: Control+Alt+F
* Select the lens view: Control+Alt+L
* Cycle through the three view types: Control+Alt+M
* Resize the lens with the keyboard: Shift+Alt+Left/Right/Up/DownArrow

The following keyboard shortcuts are also native Magnifier commands: Control+Alt+LeftArrow, Control+Alt+RightArrow, Control+Alt+UpArrow, Control+Alt+DownArrow. They are used to move the magnified view respectively to the left, the right, up or down. Since they are also table navigation commands in NVDA, they are managed as follow by this add-on:

This comment has been minimized.

Copy link
@nvdaes

nvdaes Feb 18, 2020

Grammar: replace follow with follows


* If the focus or the virtual cursor is not located in a table or a list view, the Magnifier command is executed.
* If the focus or the virtual cursor is located in a table or a list view, the NVDA table navigation command is executed
* If the focus or the virtual cursor is located in a table or a list view, the NVDA table navigation command is executed.
* If you still want to move the Magnifier's view while being in a table or a list view, you will need to press NVDA+F2 before pressing control+alt+arrowKey.


At last, here is a list of other Magnifier native commands, just for information:

* Control+Windows+M: Open the Magnifier's settings window.
* Control+Alt+R: Resize the lens with the mouse
* Shift+Alt+Left/Right/Up/DownArrow: Resize the lens with the keyboard
* Control+Alt+Space: Quickly see the entire desktop when using full screen view
* Control+Alt+R: Resize the lens with the mouse.
* Control+Alt+Space: Quickly see the entire desktop when using full screen view.

None of the Magnifier native commands can be modified.


## Notes

* For computers equiped with an Intel graphic card, control+alt+arrow (left/right/up/down) are also shortcut to modify the orientation of the screen. These shortcut are enabled by default and conflict with Windows Magnifiers shortcuts to move the view. You will need to disable them to be able to use them for the Magnifier. They can be disabled in the Intel control panel or in the Intel menu present in the systray.
* Alt+Shift+Arrow are Windows Magnifier shortcuts to resize the magnified view (lens or docked). When Magnifier is active (even in fullscreen mode), these shortcuts are captured by Magnifier and cannot be passed to the application, even if you press NVDA+F2 before. To use these shortcuts in the current application, you need to quit the Magnifier (Windows+Escape) and re-open it after (Windows++). For example in MS word, to increase title level:
* Alt+Shift+Arrow are Windows Magnifier shortcuts to resize the magnified view (lens or docked). When Magnifier is active (even in fullscreen mode), these shortcuts are captured by Magnifier and cannot be passed to the application, even if you press NVDA+F2 before. To use these shortcuts in the current application, you need to quit the Magnifier (Windows+Escape) and re-open it after (Windows++). For example in MS word, to decrease title level:

* Press Windows+Escape to quit Magnifier
* Press Alt+Shift+RightArrow to increase current title level
* Press Windows++ to re-open the Magnifier
* Press Windows+Escape to quit Magnifier.
* Press Alt+Shift+RightArrow to decrease current title level.
* Press Windows++ to re-open the Magnifier.

* For more information about Windows Magnifier's features and shortcuts, you may want to consult the following pages:

* [Use Magnifier to make things on the screen easier to see](https://support.microsoft.com/en-us/help/11542/windows-use-magnifier-to-make-things-easier-to-see)
* [Windows keyboard shortcuts for accessibility](https://support.microsoft.com/en-us/help/13810)


## Change log
Expand Down
67 changes: 38 additions & 29 deletions addon/globalPlugins/winMag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def onlyIfMagRunning(s):
@wraps(s)
def script_wrapper(self, gesture):
if not isMagnifierRunning():
# Translators: The message reported when the user tries to use a Magnifier dedicated command while the Magnifier is not running
# Translators: The message reported when the user tries to use a Magnifier dedicated command while the Magnifier is not running.
ui.message(_('The Magnifier is not active'))
return
s(self, gesture)
Expand Down Expand Up @@ -269,19 +269,19 @@ def toggle(self, eventType):
self.__class__.lastTrackingConfig = dict(cfg)
return val

# Translators: The description for the toggleCaretTracking script
# Translators: The description for the toggleCaretTracking script.
DESC_TOGGLE_CARET_TRACKING = _("Toggles on or off caret tracking")
# Translators: The description for the toggleFocusTracking script
# Translators: The description for the toggleFocusTracking script.
DESC_TOGGLE_FOCUS_TRACKING = _("Toggles on or off focus tracking")
# Translators: The description for the toggleMouseTracking script
# Translators: The description for the toggleMouseTracking script.
DESC_TOGGLE_MOUSE_TRACKING = _("Toggles on or off mouse tracking")
# Translators: The description for the toggleTracking script
# Translators: The description for the toggleTracking script.
DESC_TOGGLE_TRACKING = _("Toggles on or off tracking globally")
# Translators: The description for the toggleSmoothing script
# Translators: The description for the toggleSmoothing script.
DESC_TOGGLE_SMOOTHING = _("Toggles on or off smoothing")
# Translators: The description for the toggleMouseCursorTrackingMode script
# Translators: The description for the toggleMouseCursorTrackingMode script.
DESC_TOGGLE_MOUSE_CURSOR_TRACKING_MODE = _("Switch between mouse tracking modes (within the edge of the screen or centered on the screen)")
# Translators: The description for the displayHelp script
# Translators: The description for the displayHelp script.
DESC_DISPLAY_HELP = _("Displays help on Magnifier layer commands")

class GlobalPlugin(globalPluginHandler.GlobalPlugin):
Expand Down Expand Up @@ -324,7 +324,7 @@ def script_error(self, gesture):
beep(120, 100)

@script(
# Translators: Part of the description for the layered command script
# Translators: Part of the description for the layered command script.
description = _("Windows Magnifier layer commands entry point."),
gesture = "kb:NVDA+windows+O"
)
Expand Down Expand Up @@ -354,7 +354,7 @@ def script_zoomIn(self, gesture):
self.modifyRunningState(gesture)

@script(
gestures = ["kb:windows+numpadMinus", "kb:windows+numLock+numpadMinu", "kb:windows+" + KEY_ALPHA_MINUS, "kb:windows+-"]
gestures = ["kb:windows+numpadMinus", "kb:windows+numLock+numpadMinus", "kb:windows+" + KEY_ALPHA_MINUS, "kb:windows+-"]
)
def script_zoomOut(self, gesture):
if isMagnifierRunning():
Expand Down Expand Up @@ -390,9 +390,13 @@ def script_changeMagnificationView(self, gesture):
gesture.send()

dicArrowDir = {
# Translators: A direction reported when the user moves the magnified view.
'leftArrow': _('left'),
# Translators: A direction reported when the user moves the magnified view.
'rightArrow': _('right'),
# Translators: A direction reported when the user moves the magnified view.
'upArrow': _('up'),
# Translators: A direction reported when the user moves the magnified view.
'downArrow': _('down'),
}
def script_moveView(self, gesture):
Expand All @@ -409,17 +413,21 @@ def script_changeMagnificationWindowSize(self, gesture):
announceDim = curResize != self.lastResize or not scriptHandler.getLastScriptRepeatCount()
msg = '{dimension}: {val}' if announceDim else '{val}'
if curResize == 'width':
# Translators: A dimension reported when the user resizes the docked view.
dim = _('Widht')
val = oMag.location.width
self.lastResize = 'width'
elif curResize == 'height':
dim = _('Heigh')
# Translators: A dimension reported when the user resizes the docked view.
dim = _('Height')
val = oMag.location.height
self.lastResize = 'height'
ui.message(msg.format(dimension=dim, val=val))
elif mode == MAG_VIEW_LENS:
# Translators: A message reported when the user resizes the lens with the keyboard.
ui.message(_('Resizing lens.'))
else:
# Translators: A message reported when the user uses resizing shortcuts (control+shift+arrow) in fullscreen view.
ui.message(_('Resizing not available in full screen.'))
else:
raise RuntimeError('Unexpected case')
Expand All @@ -435,10 +443,10 @@ def script_toggleCaretTracking(self, gesture):
cfg = TrackingConfig()
val = cfg.toggle('FollowCaret')
if val:
# Translators: The message reported when the user turns on caret tracking
# Translators: The message reported when the user turns on caret tracking.
ui.message(_('Caret tracking on'))
else:
# Translators: The message reported when the user turns off caret tracking
# Translators: The message reported when the user turns off caret tracking.
ui.message(_('Caret tracking off'))

@script(
Expand All @@ -452,10 +460,10 @@ def script_toggleFocusTracking(self, gesture):
cfg = TrackingConfig()
val = cfg.toggle('FollowFocus')
if val:
# Translators: The message reported when the user turns on focus tracking
# Translators: The message reported when the user turns on focus tracking.
ui.message(_('Focus tracking on'))
else:
# Translators: The message reported when the user turns off focus tracking
# Translators: The message reported when the user turns off focus tracking.
ui.message(_('Focus tracking off'))

@script(
Expand All @@ -469,10 +477,10 @@ def script_toggleMouseTracking(self, gesture):
cfg = TrackingConfig()
val = cfg.toggle('FollowMouse')
if val:
# Translators: The message reported when the user turns on mouse tracking
# Translators: The message reported when the user turns on mouse tracking.
ui.message(_('Mouse tracking on'))
else:
# Translators: The message reported when the user turns off focus tracking
# Translators: The message reported when the user turns off focus tracking.
ui.message(_('Mouse tracking off'))
@script(
description = DESC_TOGGLE_TRACKING,
Expand All @@ -485,10 +493,10 @@ def script_toggleTracking(self, gesture):
cfg = TrackingConfig()
val = cfg.toggle('All')
if val:
# Translators: The message reported when the user turns on tracking
# Translators: The message reported when the user turns on tracking.
ui.message(_('Tracking on'))
else:
# Translators: The message reported when the user turns off tracking
# Translators: The message reported when the user turns off tracking.
ui.message(_('Tracking off'))

@script(
Expand All @@ -500,10 +508,10 @@ def script_toggleSmoothing(self, gesture):
return
val = toggleMagnifierKeyValue('UseBitmapSmoothing', default=MAG_DEFAULT_USE_BITMAP_SMOOTHING)
if val:
# Translators: The message reported when the user turns on smoothing
# Translators: The message reported when the user turns on smoothing.
ui.message(_('Smoothing on'))
else:
# Translators: The message reported when the user turns off smoothing
# Translators: The message reported when the user turns off smoothing.
ui.message(_('Smoothing off'))

@script(
Expand All @@ -526,43 +534,44 @@ def script_toggleMouseCursorTrackingMode(self, gesture):
return
val = toggleMagnifierKeyValue('FullScreenTrackingMode', default=MAG_DEFAULT_FULL_SCREEN_TRACKING_MODE)
if val:
# Translators: A message reporting mouse cursor tracking mode (cf. option in Magnifier settings)
# Translators: A message reporting mouse cursor tracking mode (cf. option in Magnifier settings).
ui.message(_('Centered on the screen'))
else:
# Translators: A message reporting mouse cursor tracking mode (cf. option in Magnifier settings)
# Translators: A message reporting mouse cursor tracking mode (cf. option in Magnifier settings).
ui.message(_('Within the edge of the screen'))

def checkSecureScreen(self):
if globalVars.appArgs.secure:
# Translators: A message reported in secure screen when the user attempts to modify magnifiers settings.
ui.message(_('Command unavailable on this screen.'))
return globalVars.appArgs.secure

def modifyRunningState(self, gesture):
fetcher = lambda: getMagnifierKeyValue('RunningState', default=MAG_DEFAULT_RUNNING_STATE)
val = _WaitForValueChangeForAction(gesture, fetcher, timeout=4)
if val == 1:
# Translators: The message reported when the user turns on the Magnifier
# Translators: The message reported when the user turns on the Magnifier.
ui.message(_('Magnifier on'))
elif val == 0:
# Translators: The message reported when the user turns off the Magnifier
# Translators: The message reported when the user turns off the Magnifier.
ui.message(_('Magnifier off'))
else:
raise ValueError('Unexpected RunningState value: {}'.format(val))

def modifyZoomLevel(self, gesture):
fetcher = lambda: getMagnifierKeyValue('Magnification', default=MAG_DEFAULT_MAGNIFICATION)
val = _WaitForValueChangeForAction(gesture, fetcher)
# Translators: A zoom level reported when the user changes the zoom level
# Translators: A zoom level reported when the user changes the zoom level.
ui.message(_('{zoomLevel}%'.format(zoomLevel=val)))

def modifyColorInversion(self, gesture):
fetcher = lambda: getMagnifierKeyValue('Invert', default=MAG_DEFAULT_INVERT)
val = _WaitForValueChangeForAction(gesture, fetcher, timeout=0.5)
if val == 1:
# Translators: The message reported when the user turns on color inversion
# Translators: The message reported when the user turns on color inversion.
ui.message(_('Color inversion on'))
elif val == 0:
# Translators: The message reported when the user turns off color inversion
# Translators: The message reported when the user turns off color inversion.
ui.message(_('Color inversion off'))
else:
raise ValueError('Unexpected Invert value: {}'.format(val))
Expand All @@ -589,6 +598,6 @@ def script_displayHelp(self, gesture):
# Translators: Title of the layered command help window.
title = _("Windows Magnifier layered commands")
cmdList = '\r'.join(s[0] + ': ' + s[2] for s in self.__magLayerScriptList)
# Translators: Part of the help message reported for the layered command help.
# Translators: Part of the help message displayed for the layered command help.
msg = _("Magnifier layer commands:\n{cmdList}").format(cmdList=cmdList)
ui.browseableMessage(msg, title)

0 comments on commit bd769e0

Please sign in to comment.