Speech commands use sequences#10371
Conversation
Definitions and all usages converted: - getControlFieldSpeech - speech.getControlFieldSpeech - browseMode.BrowseModeDocumentTextInfo.getControlFieldSpeech - textInfos.TextInfo.getControlFieldSpeech - speech.getFormatFieldSpeech - getFormatFieldSpeech - appModules.kindle.BookPageViewTextInfo.getFormatFieldSpeech - textInfos.TextInfo.getFormatFieldSpeech - treeInterceptorHandler.RootProxyTextInfo.getFormatFieldSpeech - speech.getSpeechTextForProperties - speech.getIndentationSpeech - speech.getTableInfoSpeech
| out = "" | ||
| def getFormatFieldSpeech( | ||
| self, attrs, attrsCache=None, formatConfig=None, reason=None, unit=None, extraDetail=False, | ||
| initialFormat=False, separator=speech.CHUNK_SEPARATOR |
There was a problem hiding this comment.
Param separator can be removed. Anyone disagree with this?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Not sure if issue #10363 is related to this. In this case, as an alternative, characterProcessing.processSpeechSymbols may return a sequence too? |
LeonarddeR
left a comment
There was a problem hiding this comment.
Currently this goes pretty wild on Github with firefox, it announces sections, groupings, property pages in situations I don't expect it to. Could find out that quickly where the bug is, probably somewhere in getControlFieldSpeech.
Log errors in speech sequences (unknown types, None entries, empty list entries) Must be enabled in the advanced panel, logging options.
|
Looks like system tests are failing. From the output it seems to be to do with the separator that we are no longer using. |
|
Seems like the only cases that doesn't use The definition of The This was introduced in 7f87073, which introduces browseable messages. It may be necessary to separate text with new lines for the browseable message viewer? |
In the future it would be better to test speech as structured data. This would allow us to test commands as well.
|
This is ready for testing: try build I wouldn't suggest starting to review this again until we get some confirmation from testers. The commits are a bit of a jumble at this stage. I think there is value in making these changes easy to track, so I may rebase to clean up (re-order) the commits, then do a regular merge rather than squash merge. |
|
I'm testing the try build and I find that, in browse mode, NVDA reports "paragraph" and "section" too frequently. For example, reading the last email corresponding to this PR on in Google's home page. |
LeonarddeR
left a comment
There was a problem hiding this comment.
Not really reviewing, just trying to find out what causes the reporting of roles.
| @@ -887,21 +959,36 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont | |||
| presCat=field.getPresentationCategory(newControlFieldStack[0:count],formatConfig,reason) | |||
| if not presCat or presCat is field.PRESCAT_LAYOUT: | |||
There was a problem hiding this comment.
Just a suggestion:
Initially, I thought that the presentation category code might cause the section reporting, but it is untouched. Yet, I'd like to point your attention at it. textInfos.ControlField.PRESCAT_LAYOUT is None, which to me is pretty confusing. may be it should be changed to "layout" so we can use proper type checking to avoid issues now or in the future.
There was a problem hiding this comment.
This is a good point. I would be with you on this idea, I'd be interested to know what @jcsteh thinks though?
Jamie:
In short the value for textInfos.ControlField.PRESCAT_LAYOUT is None, how risky would it be to give this an actual default value like "layout"? Is there a reliance on not being able to retrieve an attribute or dictionary value and therefore None matches the intended default?
Happy for the answer to be "Not sure, please investigate" but if you know off-hand it might save us time.
|
@nvdaes Thanks for testing
Could you confirm whether you see the same behaviour with the latest alpha?
I went looking for strange behaviour on Github with firefox with the most recent commit. I found some things I didn't expect, but this is also the case using 2019.2. |
I agree in theory, though by having a value of None the result might be that it is acting as a default when nothing else is set. We would need to track down all these cases and make it explicit. |
|
On alpha, when I do ctrl+end from the comment edit box in browse mode to get to the bottom of this github page, NVDA says: With the code of this pr, the announcement is: The The speech viewer also shows several unexpected empty lines. |
I am having trouble reproducing this (using Chrome 77.0.3865.90): I press control+end, NVDA announces: The most interesting part to me is:
This is from the end of your comment, I have no idea how that is ending up in the announcement. |
My mistake, I have too many windows open, that result was from Chrome, I will edit the comment. In Firefox 69.0.3 (64-bit), I get the following after pressing ctrl+end: |
|
Just to answer your question: No, this is specific of this PR. |
|
Working on #10462, I realized that braille contains the getBrailleTextForProperties function. Could we consider renaming this to getPropertiesBraille, in line with the rename in the speech package? There doesn't have to change anything else for braille, but I think that renaming one without the other could lead to confusion or at least introduces an inconsistency. |
I agree, this would be a good idea. Next question is where to do it? I think my preference is to follow this PR with another one specifically to rename it. |
|
I think my preference is to follow this PR with another one
specifically to rename it.
Agreed.
|
LeonarddeR
left a comment
There was a problem hiding this comment.
The behavior of the speech viewer still differs:
Old situation:
Show Speech Viewer on Startup check box not checked Alt+s
New situation:
Show Speech Viewer on Startup
check box
not checked
Alt+s
Turns out that every chunk of speech is written to a new line.
|
Apart from the speech viewer issue mentioned above, I've been using the branch from source for some time now without issues. |
Initially, my thought was this would be helpful, and it was for debugging purposes. From a usability standpoint, it's probably overall better if sequences would be joined by a space. Though there are certainly cases where people get confused looking at the speechviewer thinking that information is double speaking. I think I would prefer to solve that problem with more formatting in the speechviewer.
Great! |
Of course, I don't know how it looks visually. I only use the speech viewer to be able to copy speech sequences (also for debugging purposes), and in that case it's a bit confusing. I'd also separate every sequence with an empty line to make it visible where one sequence ends and the other starts, in that case. |
SpeechViewer.appendText renamed to appendSpeechSequence. It takes a SpeechSequence instead of a str. This allows more control over the presentation of speech, which will separate speech items with a space, and conclude with a newline.
I think this will make speech viewer too sparse. Especially considering how often newlines are already in the speech sequence. What I have now should restore the old behaviour, I think these other ideas should be discussed separately. |
LeonarddeR
left a comment
There was a problem hiding this comment.
I had another look through this. I think it looks pretty good, just some small comments and thoughts.
LeonarddeR
left a comment
There was a problem hiding this comment.
Github insisted on hiding https://github.com/nvaccess/nvda/pull/10371/files#r342995158 . Doesn't hold me back from approving this, though.
Unless @michaelDCurran wants to review this, I'd like to suggest merging this ASAP for broader testing.
In PR #10371, getSpeechTextForProperties was renamed to getPropertiesSpeech, make the equivalent change for Braille.
Link to issue number:
#10098
Summary of the issue:
In order to get many of the benefits of the speech refactor, we need to have speech sequences (rather than single strings) returned from our various
getXSpeechmethods. This will be necessary if we want to use sounds instead of text to indicate spelling errors, change voice parameters for emphasized text or links, etc.Description of how this pull request fixes the issue:
The following functions have had their definitions and usages converted:
getControlFieldSpeechspeech.getControlFieldSpeechbrowseMode.BrowseModeDocumentTextInfo.getControlFieldSpeechtextInfos.TextInfo.getControlFieldSpeechspeech.getFormatFieldSpeechgetFormatFieldSpeechappModules.kindle.BookPageViewTextInfo.getFormatFieldSpeechtextInfos.TextInfo.getFormatFieldSpeechtreeInterceptorHandler.RootProxyTextInfo.getFormatFieldSpeechspeech.getSpeechTextForPropertiesspeech.getIndentationSpeechspeech.getTableInfoSpeechThe speech function
getSpeechTextForPropertieshas been renamed togetPropertiesSpeechTesting performed:
Generally ran NVDA and inspected the log for errors:
Known issues with pull request:
Change log entry:
Section: Changes For Developers
The speech function getSpeechTextForProperties has been renamed to getPropertiesSpeech