From f9a75710314719adc61ace04d1b53656c7c95a22 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Wed, 17 May 2017 19:55:55 +0200 Subject: [PATCH 01/11] Add a "report formatting info for text under this braille cell" command. --- source/braille.py | 33 +++++++++++++++++++++++++-------- source/globalCommands.py | 26 +++++++++++++++++++++----- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/source/braille.py b/source/braille.py index 6620e48df1f..a08a70f97d0 100644 --- a/source/braille.py +++ b/source/braille.py @@ -1011,6 +1011,16 @@ def update(self): self.focusToHardLeft = self._isMultiline() super(TextInfoRegion, self).update() + def getTextInfoForBraillePos(self, braillePos): + pos = self._rawToContentPos[self.brailleToRawPos[braillePos]] + # pos is relative to the start of the reading unit. + # Therefore, get the start of the reading unit... + dest = self._readingInfo.copy() + dest.collapse() + # and move pos characters from there. + dest.move(textInfos.UNIT_CHARACTER, pos) + return dest + def routeTo(self, braillePos): if braillePos == self.brailleCursorPos: # The cursor is already at this position, @@ -1020,14 +1030,7 @@ def routeTo(self, braillePos): except NotImplementedError: pass return - - pos = self._rawToContentPos[self.brailleToRawPos[braillePos]] - # pos is relative to the start of the reading unit. - # Therefore, get the start of the reading unit... - dest = self._readingInfo.copy() - dest.collapse() - # and move pos characters from there. - dest.move(textInfos.UNIT_CHARACTER, pos) + dest = self.getTextInfoForBraillePos(braillePos) self._setCursor(dest) def nextLine(self): @@ -1310,6 +1313,15 @@ def routeTo(self, windowPos): region, pos = self.bufferPosToRegionPos(pos) region.routeTo(pos) + def getTextInfoForWindowPos(self, windowPos): + pos = self.windowStartPos + windowPos + if pos >= self.windowEndPos: + return None + region, pos = self.bufferPosToRegionPos(pos) + if not isinstance(region, TextInfoRegion): + return None + return region.getTextInfoForBraillePos(pos) + def saveWindow(self): """Save the current window so that it can be restored after the buffer is updated. The window start position is saved as a position relative to a region. @@ -1602,6 +1614,11 @@ def routeTo(self, windowPos): if self.buffer is self.messageBuffer: self._dismissMessage() + def getTextInfoForWindowPos(self, windowPos): + if self.buffer is not self.mainBuffer: + return None + return self.buffer.getTextInfoForWindowPos(windowPos) + def message(self, text): """Display a message to the user which times out after a configured interval. The timeout will be reset if the user scrolls the display. diff --git a/source/globalCommands.py b/source/globalCommands.py index efeb24c5d44..64255acaa6c 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1264,7 +1264,7 @@ def script_sayAll(self,gesture): script_sayAll.__doc__ = _("Reads from the system caret up to the end of the text, moving the caret as it goes") script_sayAll.category=SCRCAT_SYSTEMCARET - def script_reportFormatting(self,gesture): + def _reportFormatting(self, info, browseable=False): formatConfig={ "detectFormatAfterCursor":False, "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False, @@ -1275,7 +1275,6 @@ def script_reportFormatting(self,gesture): "reportBorderStyle":True,"reportBorderColor":True, } textList=[] - info=api.getReviewPosition() # First, fetch indentation. line=info.copy() @@ -1290,8 +1289,7 @@ def script_reportFormatting(self,gesture): if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField): formatField.update(field.field) - repeats=scriptHandler.getLastScriptRepeatCount() - if repeats==0: + if not browseable: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None if text: textList.append(text) @@ -1302,7 +1300,7 @@ def script_reportFormatting(self,gesture): return ui.message(" ".join(textList)) - elif repeats==1: + else: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig , separator="\n") if formatField else None if text: textList.append(text) @@ -1314,6 +1312,14 @@ def script_reportFormatting(self,gesture): # Translators: title for formatting information dialog. ui.browseableMessage(("\n".join(textList) ) , _("Formatting")) + + def script_reportFormatting(self,gesture): + info=api.getReviewPosition() + repeats=scriptHandler.getLastScriptRepeatCount() + if repeats==0: + self._reportFormatting(info,False) + elif repeats==1: + self._reportFormatting(info,True) # Translators: Input help mode message for report formatting command. script_reportFormatting.__doc__ = _("Reports formatting info for the current review cursor position within a document. If pressed twice, presents the information in browse mode") script_reportFormatting.category=SCRCAT_TEXTREVIEW @@ -1848,6 +1854,16 @@ def script_braille_routeTo(self, gesture): script_braille_routeTo.__doc__ = _("Routes the cursor to or activates the object under this braille cell") script_braille_routeTo.category=SCRCAT_BRAILLE + def script_braille_reportFormatting(self, gesture): + info = braille.handler.getTextInfoForWindowPos(gesture.routingIndex) + if info is None: + # Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor. + ui.message(_("No formatting information")) + return + self._reportFormatting(info, False) + script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell") + script_braille_reportFormatting.category=SCRCAT_BRAILLE + def script_braille_previousLine(self, gesture): if braille.handler.buffer.regions: braille.handler.buffer.regions[-1].previousLine(start=True) From ecebe946dc318291ffe8b06edb9636f9eed8ed09 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Wed, 17 May 2017 20:14:26 +0200 Subject: [PATCH 02/11] Assign the Alva BC6 secondary cursor routing keys to the new report formatting command. --- source/brailleDisplayDrivers/alvaBC6.py | 1 + 1 file changed, 1 insertion(+) diff --git a/source/brailleDisplayDrivers/alvaBC6.py b/source/brailleDisplayDrivers/alvaBC6.py index 6e2ec2816d4..5ed7aaa5d5a 100644 --- a/source/brailleDisplayDrivers/alvaBC6.py +++ b/source/brailleDisplayDrivers/alvaBC6.py @@ -121,6 +121,7 @@ def _keyCallback(self, dev, key, userData): "braille_nextLine": ("br(alvaBC6):t4",), "braille_scrollForward": ("br(alvaBC6):t5","br(alvaBC6):etouch3"), "braille_routeTo": ("br(alvaBC6):routing",), + "braille_reportFormatting": ("br(alvaBC6):routing2",), "review_top": ("br(alvaBC6):t1+t2",), "review_bottom": ("br(alvaBC6):t4+t5",), "braille_toggleTether": ("br(alvaBC6):t1+t3",), From bc39da28f427916b95d2d065de542ad769c4bd3c Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Mon, 5 Jun 2017 16:55:36 +0200 Subject: [PATCH 03/11] Update copyrights. --- source/braille.py | 2 +- source/brailleDisplayDrivers/alvaBC6.py | 2 +- source/globalCommands.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/braille.py b/source/braille.py index a08a70f97d0..f70728d9baa 100644 --- a/source/braille.py +++ b/source/braille.py @@ -2,7 +2,7 @@ #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) 2008-2017 NV Access Limited, Joseph Lee +#Copyright (C) 2008-2017 NV Access Limited, Joseph Lee, Davy Kager import sys import itertools diff --git a/source/brailleDisplayDrivers/alvaBC6.py b/source/brailleDisplayDrivers/alvaBC6.py index 5ed7aaa5d5a..446dd96e47a 100644 --- a/source/brailleDisplayDrivers/alvaBC6.py +++ b/source/brailleDisplayDrivers/alvaBC6.py @@ -2,7 +2,7 @@ #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) 2009-2011 Optelec B.V. , James Teh +#Copyright (C) 2009-2017 Optelec B.V. , James Teh , Davy Kager import braille import queueHandler diff --git a/source/globalCommands.py b/source/globalCommands.py index 64255acaa6c..c252d25f470 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -3,7 +3,7 @@ #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-2016 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer +#Copyright (C) 2006-2017 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer, Davy Kager import time import itertools From 75bf9965476b27f5b0d48f49dda9a339cefbb9ee Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sun, 11 Jun 2017 12:28:00 +0200 Subject: [PATCH 04/11] Update user guide for the new Alva BC6 key assignment. --- user_docs/en/userGuide.t2t | 1 + 1 file changed, 1 insertion(+) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 2b5a70b9f41..2f1dedb1581 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1690,6 +1690,7 @@ Please see the display's documentation for descriptions of where these keys can | Move braille display to next line | t4 | | Scroll braille display forward | t5 or etouch3 | | Route to braille cell | routing | +| Reports formatting under braille cell | routing2 | | Move to top line in review | t1+t2 | | Move to bottom line in review | t4+t5 | | Toggle braille tethered to | t1+t3 | From 9e00c8b0acc1b78079e92e437fa57f6b2969fa85 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sat, 9 Sep 2017 15:02:34 +0200 Subject: [PATCH 05/11] Also use the new report formatting braille command in both Papenmeier drivers. This removes their "route to and report formatting" behavior. Instead, it now only reports formatting without routing the cursor. --- source/brailleDisplayDrivers/papenmeier.py | 15 +++------------ .../brailleDisplayDrivers/papenmeier_serial.py | 16 +++------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/source/brailleDisplayDrivers/papenmeier.py b/source/brailleDisplayDrivers/papenmeier.py index 8d6456f11d7..cdec8bc2a29 100644 --- a/source/brailleDisplayDrivers/papenmeier.py +++ b/source/brailleDisplayDrivers/papenmeier.py @@ -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) 2012-2015 Tobias Platen, Halim Sahin, Ali-Riza Ciftcioglu, NV Access Limited +#Copyright (C) 2012-2017 Tobias Platen, Halim Sahin, Ali-Riza Ciftcioglu, NV Access Limited, Davy Kager #Author: Tobias Platen (nvda@lists.thm.de) -#minor changes by Halim Sahin (nvda@lists.thm.de), Ali-Riza Ciftcioglu and James Teh +#minor changes by Halim Sahin (nvda@lists.thm.de), Ali-Riza Ciftcioglu , James Teh and Davy Kager import time import itertools @@ -472,12 +472,6 @@ def _handleKeyPresses(self): if(self._dev!=None): self._dev.close() self._dev=None - def script_upperRouting(self, gesture): - globalCommands.commands.script_braille_routeTo(gesture) - wx.CallLater(50, scriptHandler.executeScript, globalCommands.commands.script_reportFormatting, gesture) - - script_upperRouting.__doc__ = _("Route to and report formatting") - #global gestures gestureMap = inputCore.GlobalGestureMap({ "globalCommands.GlobalCommands": { @@ -486,6 +480,7 @@ def script_upperRouting(self, gesture): "braille_previousLine": ("br(papenmeier):up",), "braille_nextLine": ("br(papenmeier):dn",), "braille_routeTo": ("br(papenmeier):route",), + "braille_reportFormatting": ("br(papenmeier):upperRouting",), "braille_toggleTether": ("br(papenmeier):r2",), "review_currentCharacter": ("br(papenmeier):l1",), @@ -510,10 +505,6 @@ def script_upperRouting(self, gesture): } }) - __gestures = { - "br(papenmeier):upperRouting": "upperRouting", - } - class InputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture): """Input gesture for papenmeier displays""" source = BrailleDisplayDriver.name diff --git a/source/brailleDisplayDrivers/papenmeier_serial.py b/source/brailleDisplayDrivers/papenmeier_serial.py index a8a258dc476..b396b03a75d 100644 --- a/source/brailleDisplayDrivers/papenmeier_serial.py +++ b/source/brailleDisplayDrivers/papenmeier_serial.py @@ -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) 2012-2013 Tobias Platen, Halim Sahin, Ali-Riza Ciftcioglu, NV Access Limited +#Copyright (C) 2012-2017 Tobias Platen, Halim Sahin, Ali-Riza Ciftcioglu, NV Access Limited, Davy Kager #Author: Tobias Platen (nvda@lists.thm.de) -#minor changes by Halim Sahin (nvda@lists.thm.de), Ali-Riza Ciftcioglu and James Teh +#minor changes by Halim Sahin (nvda@lists.thm.de), Ali-Riza Ciftcioglu , James Teh and Davy Kager #used braille port selection code from braillenote driver from collections import OrderedDict @@ -150,13 +150,6 @@ def __init__(self, port): self._keyCheckTimer = wx.PyTimer(self._handleKeyPresses) self._keyCheckTimer.Start(KEY_CHECK_INTERVAL) - def script_upperRouting(self, gesture): - globalCommands.commands.script_braille_routeTo(gesture) - wx.CallLater(50, scriptHandler.executeScript, globalCommands.commands.script_reportFormatting, gesture) - - # Translators: Describes action of routing buttons on a braille display. - script_upperRouting.__doc__ = _("Route to and report formatting") - def terminate(self): """free resources""" super(BrailleDisplayDriver, self).terminate() @@ -211,6 +204,7 @@ def _handleKeyPresses(self): #called by the keycheck timer "braille_previousLine": ("br(papenmeier_serial):up",), "braille_nextLine": ("br(papenmeier_serial):dn",), "braille_routeTo": ("br(papenmeier_serial):route",), + "braille_reportFormatting": ("br(papenmeier_serial):upperRouting",), "braille_toggleTether": ("br(papenmeier_serial):r2",), "review_currentCharacter": ("br(papenmeier_serial):l1",), @@ -227,10 +221,6 @@ def _handleKeyPresses(self): #called by the keycheck timer } }) - __gestures = { - "br(papenmeier_serial):upperRouting": "upperRouting", - } - def brl_keyname2(keys): """returns keyname for key index on displays with eab""" if(keys & 4 == 4): return 'l1' From ae26aaf0e51230bd81aec45b59f2793a847d6c1b Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 6 Feb 2018 20:52:10 +0100 Subject: [PATCH 06/11] Address review actions. --- source/globalCommands.py | 17 +++++++---------- source/ui.py | 2 +- user_docs/en/userGuide.t2t | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 8b2101c8785..21c1c8f5104 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1279,7 +1279,7 @@ def script_sayAll(self,gesture): script_sayAll.__doc__ = _("Reads from the system caret up to the end of the text, moving the caret as it goes") script_sayAll.category=SCRCAT_SYSTEMCARET - def _reportFormatting(self, info, browseable=False): + def _reportFormattingHelper(self, info): formatConfig={ "detectFormatAfterCursor":False, "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False, @@ -1304,7 +1304,8 @@ def _reportFormatting(self, info, browseable=False): if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField): formatField.update(field.field) - if not browseable: + repeats=scriptHandler.getLastScriptRepeatCount() + if repeats==0: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None if text: textList.append(text) @@ -1315,7 +1316,7 @@ def _reportFormatting(self, info, browseable=False): return ui.message(" ".join(textList)) - else: + elif repeats==1: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig , separator="\n") if formatField else None if text: textList.append(text) @@ -1326,15 +1327,11 @@ def _reportFormatting(self, info, browseable=False): return # Translators: title for formatting information dialog. - ui.browseableMessage(("\n".join(textList) ) , _("Formatting")) + ui.browseableMessage("\n".join(textList), _("Formatting")) def script_reportFormatting(self,gesture): info=api.getReviewPosition() - repeats=scriptHandler.getLastScriptRepeatCount() - if repeats==0: - self._reportFormatting(info,False) - elif repeats==1: - self._reportFormatting(info,True) + self._reportFormattingHelper(info) # Translators: Input help mode message for report formatting command. script_reportFormatting.__doc__ = _("Reports formatting info for the current review cursor position within a document. If pressed twice, presents the information in browse mode") script_reportFormatting.category=SCRCAT_TEXTREVIEW @@ -1919,7 +1916,7 @@ def script_braille_reportFormatting(self, gesture): # Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor. ui.message(_("No formatting information")) return - self._reportFormatting(info, False) + self._reportFormattingHelper(info) script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell") script_braille_reportFormatting.category=SCRCAT_BRAILLE diff --git a/source/ui.py b/source/ui.py index 12c697da63f..eab3dc45070 100644 --- a/source/ui.py +++ b/source/ui.py @@ -32,7 +32,7 @@ HTMLDLG_PRINT_TEMPLATE = 0x0080 HTMLDLG_VERIFY = 0x0100 -def browseableMessage(message,title=None , isHtml=False): +def browseableMessage(message,title=None,isHtml=False): """Present a message to the user that can be read in browse mode. The message will be presented in an HTML document. @param message: The message in either html or text. diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 36f3a5c9788..65fd9ed910b 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1927,7 +1927,7 @@ Please see the display's documentation for descriptions of where these keys can | Move braille display to next line | t4 | | Scroll braille display forward | t5 or etouch3 | | Route to braille cell | routing | -| Reports formatting under braille cell | secondRouting | +| Report formatting under braille cell | secondRouting | | Toggle HID keyboard simulation | t1+spEnter | | Move to top line in review | t1+t2 | | Move to bottom line in review | t4+t5 | From 09026c5d7bd3c40dee16ee0503a90b06b7ac4b30 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sat, 10 Feb 2018 11:20:05 +0100 Subject: [PATCH 07/11] Update user docs. --- source/globalCommands.py | 2 +- user_docs/en/userGuide.t2t | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 21c1c8f5104..8b4412d21f7 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1917,7 +1917,7 @@ def script_braille_reportFormatting(self, gesture): ui.message(_("No formatting information")) return self._reportFormattingHelper(info) - script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell") + script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell. If pressed twice, presents the information in browse mode") script_braille_reportFormatting.category=SCRCAT_BRAILLE def script_braille_previousLine(self, gesture): diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index a02ac85b85c..34e0b23944f 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1919,7 +1919,7 @@ Please see the display's documentation for descriptions of where these keys can | Move braille display to next line | t4 | | Scroll braille display forward | t5 or etouch3 | | Route to braille cell | routing | -| Report formatting under braille cell | secondRouting | +| Report text formatting under braille cell | secondary routing | | Toggle HID keyboard simulation | t1+spEnter | | Move to top line in review | t1+t2 | | Move to bottom line in review | t4+t5 | @@ -2253,7 +2253,7 @@ Following are the Papenmeier command assignments for NVDA: | Move to first contained object | dn2 | | Move to previous object | left2 | | Move to next object | right2 | -| Report text formatting | upper routing row | +| Report text formatting under braille cell | upper routing row | %kc:endInclude The Trio model has four additional keys which are in front of the braille keyboard. @@ -2327,7 +2327,7 @@ Devices with EAB: | Move to first contained object | dn2 | | Move to next object | right2 | | Move to previous object | left2 | -| Report text formatting | Upper routing strip | +| Report text formatting under braille cell | upper routing strip | BRAILLEX Tiny: || Name | Key | @@ -2342,7 +2342,7 @@ BRAILLEX Tiny: | Move to first contained object | r1+dn | | Move to previous object | r1+left | | Move to next object | r1+right | -| Report text formatting | reportf | +| Report text formatting under braille cell | upper routing strip | | Report title | l1+up | | Report status bar | l2+down | @@ -2351,7 +2351,7 @@ BRAILLEX 2D Screen: | Report current character in review | l1 | | Activate current navigator object | l2 | | Toggle braille tethered to | r2 | -| Report text formatting | reportf | +| Report text formatting under braille cell | upper routing strip | | Move braille display to previous line | up | | Scroll braille display back | left | | Scroll braille display forward | right | From 10e1f758e0829dbcea89ed64efe9caef9eefe3ca Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sat, 10 Feb 2018 11:27:11 +0100 Subject: [PATCH 08/11] Add the report text formatting under braille cell command to the EuroBraille displays. --- source/brailleDisplayDrivers/eurobraille.py | 3 ++- user_docs/en/userGuide.t2t | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/brailleDisplayDrivers/eurobraille.py b/source/brailleDisplayDrivers/eurobraille.py index f36eff7845f..641e8b916ae 100644 --- a/source/brailleDisplayDrivers/eurobraille.py +++ b/source/brailleDisplayDrivers/eurobraille.py @@ -481,7 +481,8 @@ def announceUnavailableMessage(): gestureMap = inputCore.GlobalGestureMap({ "globalCommands.GlobalCommands": { - "braille_routeTo": ("br(eurobraille):routing","br(eurobraille):doubleRouting",), + "braille_routeTo": ("br(eurobraille):routing",), + "braille_reportFormatting": ("br(eurobraille):doubleRouting",), "braille_scrollBack": ( "br(eurobraille):switch1Left", "br(eurobraille):l1", diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 34e0b23944f..2080f4f633a 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -2472,7 +2472,8 @@ Please see the display's documentation for descriptions of where these keys can | Scroll braille display back | switch1-6left, l1 | | Scroll braille display forward | switch1-6Right, l8 | | Move to current focus | switch1-6Left+switch1-6Right, l1+l8 | -| Route to braille cell | routing, doubleRouting| +| Route to braille cell | routing | +| Report text formatting under braille cell | doubleRouting | | Move to previous line in review | joystick1Up | | Move to next line in review | joystick1Down | | Move to previous character in review | joystick1Left | From 310473f632352cbf98d073a0765bbfa95f0d08f3 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sat, 10 Feb 2018 22:04:13 +0100 Subject: [PATCH 09/11] Revert browseable message for the report text formatting under braille cell command. --- source/globalCommands.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source/globalCommands.py b/source/globalCommands.py index 8b4412d21f7..19b0bbe0cec 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1279,7 +1279,7 @@ def script_sayAll(self,gesture): script_sayAll.__doc__ = _("Reads from the system caret up to the end of the text, moving the caret as it goes") script_sayAll.category=SCRCAT_SYSTEMCARET - def _reportFormattingHelper(self, info): + def _reportFormattingHelper(self, info, browseable=False): formatConfig={ "detectFormatAfterCursor":False, "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False, @@ -1304,8 +1304,7 @@ def _reportFormattingHelper(self, info): if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField): formatField.update(field.field) - repeats=scriptHandler.getLastScriptRepeatCount() - if repeats==0: + if not browseable: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None if text: textList.append(text) @@ -1316,7 +1315,7 @@ def _reportFormattingHelper(self, info): return ui.message(" ".join(textList)) - elif repeats==1: + else: text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig , separator="\n") if formatField else None if text: textList.append(text) @@ -1331,7 +1330,11 @@ def _reportFormattingHelper(self, info): def script_reportFormatting(self,gesture): info=api.getReviewPosition() - self._reportFormattingHelper(info) + repeats=scriptHandler.getLastScriptRepeatCount() + if repeats==0: + self._reportFormattingHelper(info,False) + elif repeats==1: + self._reportFormattingHelper(info,True) # Translators: Input help mode message for report formatting command. script_reportFormatting.__doc__ = _("Reports formatting info for the current review cursor position within a document. If pressed twice, presents the information in browse mode") script_reportFormatting.category=SCRCAT_TEXTREVIEW @@ -1916,8 +1919,8 @@ def script_braille_reportFormatting(self, gesture): # Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor. ui.message(_("No formatting information")) return - self._reportFormattingHelper(info) - script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell. If pressed twice, presents the information in browse mode") + self._reportFormattingHelper(info, False) + script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell") script_braille_reportFormatting.category=SCRCAT_BRAILLE def script_braille_previousLine(self, gesture): From ca41d27eaf1f4f4fb261e2d0f4bbbeeb0b87384e Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Tue, 13 Feb 2018 07:20:39 +0100 Subject: [PATCH 10/11] Incorporate PR #7990. --- source/globalCommands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/source/globalCommands.py b/source/globalCommands.py index 19b0bbe0cec..20d61a28bd2 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1298,6 +1298,7 @@ def _reportFormattingHelper(self, info, browseable=False): if indentation: textList.append(speech.getIndentationSpeech(indentation, formatConfig)) + info=info.copy() info.expand(textInfos.UNIT_CHARACTER) formatField=textInfos.FormatField() for field in info.getTextWithFields(formatConfig): From c948e734ef9bdd336993b26c4bfbb9329337eb41 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Fri, 9 Mar 2018 02:59:46 +1000 Subject: [PATCH 11/11] Add translator comment --- source/globalCommands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/source/globalCommands.py b/source/globalCommands.py index 20d61a28bd2..758551ae614 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -1921,6 +1921,7 @@ def script_braille_reportFormatting(self, gesture): ui.message(_("No formatting information")) return self._reportFormattingHelper(info, False) + # Translators: Input help mode message for Braille report formatting command. script_braille_reportFormatting.__doc__ = _("Reports formatting info for the text under this braille cell") script_braille_reportFormatting.category=SCRCAT_BRAILLE