Skip to content

Commit

Permalink
Use QuickNav Reason (PR #12939)
Browse files Browse the repository at this point in the history
* Treat FOCUS and QUICKNAV identically

OutputReason.QUICKNAV was generally not used, not at all in the chain of
calls resulting from speech.speakTextInfo

Treat QUICKNAV in the same way as FOCUS so that they can be
differentiated in the future.
 
* Use OutputReason.QUICKNAV when initiating a quickNav gesture.
  • Loading branch information
feerrenrut committed Oct 21, 2021
1 parent 3c0c8ed commit 5114ccc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/browseMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def report(self,readUnit=None):
if info.compareEndPoints(fieldInfo, "endToEnd") > 0:
# We've expanded past the end of the field, so limit to the end of the field.
info.setEndPoint(fieldInfo, "endToEnd")
speech.speakTextInfo(info, reason=OutputReason.FOCUS)
speech.speakTextInfo(info, reason=OutputReason.QUICKNAV)

def activate(self):
self.textInfo.obj._activatePosition(info=self.textInfo)
Expand Down
18 changes: 11 additions & 7 deletions source/speech/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ def getTextInfoSpeech( # noqa: C901
speechSequence: SpeechSequence = []
# #2591: Only if the reason is not focus, Speak the exit of any controlFields not in the new stack.
# We don't do this for focus because hearing "out of list", etc. isn't useful when tabbing or using quick navigation and makes navigation less efficient.
if reason != OutputReason.FOCUS:
if reason not in [OutputReason.FOCUS, OutputReason.QUICKNAV]:
endingBlock=False
for count in reversed(range(commonFieldCount,len(controlFieldStackCache))):
fieldSequence = info.getControlFieldSpeech(
Expand Down Expand Up @@ -1554,7 +1554,8 @@ def getPropertiesSpeech( # noqa: C901
or reason not in (
OutputReason.SAYALL,
OutputReason.CARET,
OutputReason.FOCUS
OutputReason.FOCUS,
OutputReason.QUICKNAV
)
or not (
name
Expand Down Expand Up @@ -1732,7 +1733,7 @@ def _shouldSpeakContentFirst(
controlTypes.Role.REGION,
)
return (
reason == OutputReason.FOCUS
reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
and (
# the category is not a container, unless it's an article (#11103)
presCat != attrs.PRESCAT_CONTAINER
Expand Down Expand Up @@ -1769,7 +1770,7 @@ def getControlFieldSpeech( # noqa: C901
childControlCount=int(attrs.get('_childcontrolcount',"0"))
role = attrs.get('role', controlTypes.Role.UNKNOWN)
if (
reason == OutputReason.FOCUS
reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
or attrs.get('alwaysReportName', False)
):
name = attrs.get('name', "")
Expand Down Expand Up @@ -1802,7 +1803,7 @@ def getControlFieldSpeech( # noqa: C901
(
config.conf["presentation"]["reportObjectDescriptions"]
and not _descriptionIsContent
and reason == OutputReason.FOCUS
and reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
)
or (
# 'alwaysReportDescription' provides symmetry with 'alwaysReportName'.
Expand Down Expand Up @@ -1907,7 +1908,7 @@ def getControlFieldSpeech( # noqa: C901
return tableSeq
elif (
nameSequence
and reason == OutputReason.FOCUS
and reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
and fieldType == "start_addedToControlFieldStack"
and role in (controlTypes.Role.GROUPING, controlTypes.Role.PROPERTYPAGE)
):
Expand Down Expand Up @@ -2138,7 +2139,10 @@ def getFormatFieldSpeech( # noqa: C901
headingLevel
and (
initialFormat
and (reason == OutputReason.FOCUS or unit in (textInfos.UNIT_LINE, textInfos.UNIT_PARAGRAPH))
and (
reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
or unit in (textInfos.UNIT_LINE, textInfos.UNIT_PARAGRAPH)
)
or headingLevel != oldHeadingLevel
)
):
Expand Down
2 changes: 1 addition & 1 deletion source/textInfos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def getPresentationCategory(

name = self.get("name")
landmark = self.get("landmark")
if reason in (OutputReason.CARET, OutputReason.SAYALL, OutputReason.FOCUS) and (
if reason in (OutputReason.CARET, OutputReason.SAYALL, OutputReason.FOCUS, OutputReason.QUICKNAV) and (
(role == controlTypes.Role.LINK and not formatConfig["reportLinks"])
or (role == controlTypes.Role.GRAPHIC and not formatConfig["reportGraphics"])
or (role == controlTypes.Role.HEADING and not formatConfig["reportHeadings"])
Expand Down

0 comments on commit 5114ccc

Please sign in to comment.