Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/appModules/kindle.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def script_showSelectionOptions(self, gesture):
# so retrieve and report the selection from Kindle.
# we can't just use self.makeTextInfo, as that will use our fake selection.
realSel = self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION)
# Translators: Announces selected text. %s is replaced with the text.
speech.speakSelectionMessage(_("selected %s"), realSel.text)
speech.speakSelectedText(realSel.text)
# Remove our virtual selection and move the caret to the active end.
fakeSel.innerTextInfo = realSel
fakeSel.collapse(end=not self._lastSelectionMovedStart)
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/powerpnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ def event_treeInterceptor_gainFocus(self):
else:
info = self.selection
if not info.isCollapsed:
speech.speakSelectionMessage(_("selected %s"), info.text)
speech.speakSelectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.REASON_CARET, unit=textInfos.UNIT_LINE)
Expand Down
2 changes: 1 addition & 1 deletion source/browseMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ def event_treeInterceptor_gainFocus(self):
speech.speakObject(self.rootNVDAObject, reason=controlTypes.REASON_FOCUS)
info = self.selection
if not info.isCollapsed:
speech.speakSelectionMessage(_("selected %s"), info.text)
speech.speakSelectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.REASON_CARET, unit=textInfos.UNIT_LINE)
Expand Down
2 changes: 1 addition & 1 deletion source/compoundDocuments.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def event_treeInterceptor_gainFocus(self):
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=controlTypes.REASON_CARET)
else:
speech.speakSelectionMessage(_("selected %s"), info.text)
speech.speakSelectedText(info.text)
braille.handler.handleGainFocus(self)
self.initAutoSelectDetection()

Expand Down
2 changes: 1 addition & 1 deletion source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def script_reportCurrentSelection(self,gesture):
if not info or info.isCollapsed:
speech.speakMessage(_("No selection"))
else:
speech.speakMessage(_("Selected %s")%info.text)
speech.speakSelectedText(info.text)
# Translators: Input help mode message for report current selection command.
script_reportCurrentSelection.__doc__=_("Announces the current selection in edit controls and documents. If there is no selection it says so.")
script_reportCurrentSelection.category=SCRCAT_SYSTEMCARET
Expand Down
13 changes: 7 additions & 6 deletions source/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ def speakObject(obj,reason=controlTypes.REASON_QUERY,index=None):
info=obj.makeTextInfo(textInfos.POSITION_SELECTION)
if not info.isCollapsed:
# if there is selected text, then there is a value and we do not report placeholder
# Translators: This is spoken to indicate what has been selected. for example 'selected hello world'
speakSelectionMessage(_("selected %s"),info.text)
speakSelectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
_speakPlaceholderIfEmpty(info, obj, reason)
Expand Down Expand Up @@ -587,6 +586,10 @@ def speak(speechSequence,symbolLevel=None):
speechSequence[index]+=CHUNK_SEPARATOR
getSynth().speak(speechSequence)

def speakSelectedText(text):
Comment thread
feerrenrut marked this conversation as resolved.
# Translators: This is spoken to indicate what has been selected. for example 'hello world selected'
speakSelectionMessage(_("%s selected"),text)

def speakSelectionMessage(message,text):
if len(text) < 512:
speakMessage(message % text)
Expand Down Expand Up @@ -644,14 +647,12 @@ def speakSelectionChange(oldInfo,newInfo,speakSelected=True,speakUnselected=True
for text in selectedTextList:
if len(text)==1:
text=characterProcessing.processSpeechSymbol(locale,text)
# Translators: This is spoken while the user is in the process of selecting something, For example: "hello selected"
speakSelectionMessage(_("%s selected"),text)
speakSelectedText(text)
elif len(selectedTextList)>0:
text=newInfo.text
if len(text)==1:
text=characterProcessing.processSpeechSymbol(locale,text)
# Translators: This is spoken to indicate what has been selected. for example 'selected hello world'
speakSelectionMessage(_("selected %s"),text)
speakSelectedText(text)
if speakUnselected:
if not generalize:
for text in unselectedTextList:
Expand Down