diff --git a/source/sayAllHandler.py b/source/sayAllHandler.py index bb3b7f42ba1..ff4b5884b7e 100644 --- a/source/sayAllHandler.py +++ b/source/sayAllHandler.py @@ -16,6 +16,10 @@ from speech.commands import CallbackCommand, EndUtteranceCommand + +speakWithoutPauses = speech.SpeechWithoutPauses(speakFunc=speech.speak).speakWithoutPauses + + CURSOR_CARET = 0 CURSOR_REVIEW = 1 @@ -150,7 +154,7 @@ def nextLine(self): if isinstance(self.reader.obj, textInfos.DocumentWithPageTurns): # Once the last line finishes reading, try turning the page. cb = CallbackCommand(self.turnPage, name="say-all:turnPage") - speech.speakWithoutPauses([cb, EndUtteranceCommand()]) + speakWithoutPauses([cb, EndUtteranceCommand()]) else: self.finish() return @@ -182,7 +186,7 @@ def _onLineReached(obj=self.reader.obj, state=state): seq = list(speech._flattenNestedSequences(speechGen)) seq.insert(0, cb) # Speak the speech sequence. - spoke = speech.speakWithoutPauses(seq) + spoke = speakWithoutPauses(seq) # Update the textInfo state ready for when speaking the next line. self.speakTextInfoState = state.copy() @@ -204,7 +208,7 @@ def _onLineReached(obj=self.reader.obj, state=state): else: # We don't want to buffer too much. # Force speech. lineReached will resume things when speech catches up. - speech.speakWithoutPauses(None) + speakWithoutPauses(None) # The first buffered line has now started speaking. self.numBufferedLines -= 1 @@ -241,7 +245,7 @@ def finish(self): # we might switch synths too early and truncate the final speech. # We do this by putting a CallbackCommand at the start of a new utterance. cb = CallbackCommand(self.stop, name="say-all:stop") - speech.speakWithoutPauses([ + speakWithoutPauses([ EndUtteranceCommand(), cb, EndUtteranceCommand() diff --git a/source/speech/__init__.py b/source/speech/__init__.py index 520d2400001..befd122ebfe 100755 --- a/source/speech/__init__.py +++ b/source/speech/__init__.py @@ -51,7 +51,6 @@ Generator, Union, Callable, - Iterator, Tuple, ) from logHandler import log @@ -466,7 +465,6 @@ def getObjectSpeech( # noqa: C901 reason: OutputReason = OutputReason.QUERY, _prefixSpeechCommand: Optional[SpeechCommand] = None, ): - from NVDAObjects import NVDAObjectTextInfo role=obj.role # Choose when we should report the content of this object's textInfo, rather than just the object's value import browseMode @@ -2538,10 +2536,6 @@ def _getSpeech( _speakWithoutPauses = SpeechWithoutPauses(speakFunc=speak) -#: Alias for class SpeakWithoutPauses.speakWithoutPauses. Kept for backwards compatibility -speakWithoutPauses = _speakWithoutPauses.speakWithoutPauses -#: Kept for backwards compatibility. -re_last_pause = _speakWithoutPauses.re_last_pause #: The singleton _SpeechManager instance used for speech functions. #: @type: L{manager.SpeechManager} diff --git a/tests/unit/test_SpeechWithoutPauses.py b/tests/unit/test_SpeechWithoutPauses.py index a2559c6dc91..720501495c9 100644 --- a/tests/unit/test_SpeechWithoutPauses.py +++ b/tests/unit/test_SpeechWithoutPauses.py @@ -10,7 +10,7 @@ from speech.types import SpeechSequence from speech.commands import EndUtteranceCommand, LangChangeCommand, CallbackCommand -from speech import re_last_pause, SpeechWithoutPauses +from speech import SpeechWithoutPauses from logHandler import log @@ -89,7 +89,7 @@ def old_speakWithoutPauses( # noqa: C901 for index in range(len(speechSequence) - 1, -1, -1): item = speechSequence[index] if isinstance(item, str): - m = re_last_pause.match(item) + m = SpeechWithoutPauses.re_last_pause.match(item) if m: before, after = m.groups() if after: diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index 7dbae0b4ab1..438c15fafb6 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -81,6 +81,8 @@ What's New in NVDA - `autoSettingsUtils.driverSetting` classes are removed from `driverHandler` - please use them from `autoSettingUtils.driverSetting`. (#12168) - `autoSettingsUtils.utils` classes are removed from `driverHandler` - please use them from `autoSettingUtils.utils`. (#12168) - Support of `TextInfo`s that do not inherit from `contentRecog.BaseContentRecogTextInfo` is removed. (#12157) +- `speech.speakWithoutPauses` has been removed - please use `speech.SpeechWithoutPauses(speakFunc=speech.speak).speakWithoutPauses` instead. (#12195) +- `speech.re_last_pause` has been removed - please use `speech.SpeechWithoutPauses.re_last_pause` instead. (#12195) = 2020.4 =