From e53465e9c24f9847f48f7f92c05f01278909d27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Thu, 18 Mar 2021 20:40:18 +0100 Subject: [PATCH 1/5] Remove deprecated alias `re_last_pause` and usages --- source/speech/__init__.py | 2 -- tests/unit/test_SpeechWithoutPauses.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/speech/__init__.py b/source/speech/__init__.py index 520d2400001..3d32fe794c7 100755 --- a/source/speech/__init__.py +++ b/source/speech/__init__.py @@ -2540,8 +2540,6 @@ def _getSpeech( #: 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: From f262eceb3c34a4ef00259966b1156d7f0301fa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Thu, 18 Mar 2021 22:22:06 +0100 Subject: [PATCH 2/5] remove alias `speakWithoutPauses` from `speech` and usages --- source/sayAllHandler.py | 12 ++++++++---- source/speech/__init__.py | 2 -- 2 files changed, 8 insertions(+), 6 deletions(-) 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 3d32fe794c7..41c0b943783 100755 --- a/source/speech/__init__.py +++ b/source/speech/__init__.py @@ -2538,8 +2538,6 @@ def _getSpeech( _speakWithoutPauses = SpeechWithoutPauses(speakFunc=speak) -#: Alias for class SpeakWithoutPauses.speakWithoutPauses. Kept for backwards compatibility -speakWithoutPauses = _speakWithoutPauses.speakWithoutPauses #: The singleton _SpeechManager instance used for speech functions. #: @type: L{manager.SpeechManager} From a672b1940bc5f93fd6e36d6b4f514ee86dcd9427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Thu, 18 Mar 2021 22:27:00 +0100 Subject: [PATCH 3/5] speech/__init__.py: Remove unused imports --- source/speech/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/speech/__init__.py b/source/speech/__init__.py index 41c0b943783..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 From f80bffbc2a6fd5e3da4b1dbe69855bce7360e248 Mon Sep 17 00:00:00 2001 From: buddsean Date: Mon, 22 Mar 2021 14:39:22 +1100 Subject: [PATCH 4/5] update changes.t2t --- user_docs/en/changes.t2t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index 7dbae0b4ab1..de6a8ca1bcf 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 = From 1c842b3d31ed7276c8799e6f2927dcc8b56a6210 Mon Sep 17 00:00:00 2001 From: buddsean Date: Mon, 22 Mar 2021 14:57:44 +1100 Subject: [PATCH 5/5] update changes.t2t, trigger appveyor --- user_docs/en/changes.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index de6a8ca1bcf..438c15fafb6 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -81,7 +81,7 @@ 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.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)