Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make several speech functions return sequences instead of strings #10098

Closed
leonardder opened this issue Aug 15, 2019 · 5 comments
Closed

Make several speech functions return sequences instead of strings #10098

leonardder opened this issue Aug 15, 2019 · 5 comments
Assignees
Milestone

Comments

@leonardder
Copy link
Collaborator

@leonardder leonardder commented Aug 15, 2019

Brought up by @jcsteh

Is your feature request related to a problem? Please describe.

Something that's going to be needed to get the full benefit of speech refactor is to make speech.getControlFieldSpeech and speech.getFormatFieldSpeech return speech sequences instead of simple strings. For example, this will be necessary if we want to use sounds instead of text to indicate spelling errors, change voice parameters for emphasised text or links, etc.

Originally, @jcsteh intended this to be done later. However, given that it's a pretty big backwards compatibility break, He pointed out whether it'd make sense to do that before the first Python 3 based release is shipped.

Describe the solution you'd like

The following functions need to return speech sequences (lists) instead of strings:
Note: used git grep -E "def get(\w+)Speech"

  • speech.getSpeechTextForProperties: rename while at it?
  • speech.getControlFieldSpeech
  • speech.getFormatFieldSpeech
  • appModules.kindle.BookPageViewTextInfo.getFormatFieldSpeech
  • browseMode.BrowseModeDocumentTextInfo.getControlFieldSpeech
  • treeInterceptorHandler.RootProxyTextInfo.getFormatFieldSpeech: It actually amazes me that there is no treeInterceptorHandler.RootProxyTextInfo.getControlFieldSpeech override

@derekriemer brought up speech.getIndentationSpeech, whereas I'd say speech.getTableInfoSpeech is also a candidate.

Describe alternatives you've considered

Leave code as is now. It shouldn't be very difficult to add backwards compatibility later on by means of instance checking for controlFieldSpeech and formatFieldSPeech provided by custom TextInfo implementations.

Cc @feerrenrut

@leonardder leonardder added this to To do in Update NVDA to Python 3 via automation Aug 15, 2019
@jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Aug 16, 2019

Describe alternatives you've considered

Leave code as is now. It shouldn't be very difficult to add backwards compatibility later on by means of instance checking for controlFieldSpeech and formatFieldSPeech provided by custom TextInfo implementations.

I thought of this and was considering it back in the days when I was trying hard to have a compatibility layer for pre speech refactor things. I don't think this is going to be feasible. Most getControl/FormatFieldSpeech implementations are going to extend the superclass implementation, not just override it; i.e. they'll call super and expect that to be a string. Unless we want to have the superclass inspect the stack, realise it's being called by an outdated caller and modify its return type accordingly, accepting that any add-ons that depend on this will break bits of NVDA functionality (e.g. inbuilt audio cues) whenever that add-on overrides getControl/FormatFieldSpeech. I think trying to do this would be a world of pain.

@derekriemer
Copy link
Collaborator

@derekriemer derekriemer commented Aug 16, 2019

@feerrenrut
Copy link
Member

@feerrenrut feerrenrut commented Oct 9, 2019

Any suggestions for a better name for getSpeechTextForProperties ?

  • getSpeechSequenceForProperties?
  • getPropertiesSpeech?

@leonardder
Copy link
Collaborator Author

@leonardder leonardder commented Oct 9, 2019

@jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Oct 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

4 participants