本文整理汇总了Python中speech.speakText函数的典型用法代码示例。如果您正苦于以下问题:Python speakText函数的具体用法?Python speakText怎么用?Python speakText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了speakText函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _handleInputHelp
def _handleInputHelp(self, gesture, onlyLog=False):
textList = [gesture.displayName]
script = gesture.script
runScript = False
logMsg = "Input help: gesture %s"%gesture.logIdentifier
if script:
scriptName = scriptHandler.getScriptName(script)
logMsg+=", bound to script %s" % scriptName
scriptLocation = scriptHandler.getScriptLocation(script)
if scriptLocation:
logMsg += " on %s" % scriptLocation
if scriptName == "toggleInputHelp":
runScript = True
else:
desc = script.__doc__
if desc:
textList.append(desc)
log.info(logMsg)
if onlyLog:
return
import braille
braille.handler.message("\t\t".join(textList))
# Punctuation must be spoken for the gesture name (the first chunk) so that punctuation keys are spoken.
speech.speakText(textList[0], reason=controlTypes.REASON_MESSAGE, symbolLevel=characterProcessing.SYMLVL_ALL)
for text in textList[1:]:
speech.speakMessage(text)
if runScript:
script(gesture)
开发者ID:nvaccess,项目名称:nvda,代码行数:31,代码来源:inputCore.py
示例2: event_valueChange
def event_valueChange(self):
global lastMSNHistoryValue
if winUser.isDescendantWindow(winUser.getForegroundWindow(),self.windowHandle):
value=self.value
if value!=lastMSNHistoryValue and config.conf["presentation"]["reportDynamicContentChanges"]:
speech.speakText(value)
lastMSNHistoryValue=value
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:7,代码来源:msnmsgr.py
示例3: reportFocus
def reportFocus(self):
if not config.conf["inputComposition"]["announceSelectedCandidate"]: return
text=self.name
desc=self.description
if desc:
text+=u", "+desc
speech.speakText(text)
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:7,代码来源:behaviors.py
示例4: event_mouseMove
def event_mouseMove(self,x,y):
if not self._mouseEntered and config.conf['mouse']['reportObjectRoleOnMouseEnter']:
speech.cancelSpeech()
speech.speakObjectProperties(self,role=True)
speechWasCanceled=True
else:
speechWasCanceled=False
self._mouseEntered=True
try:
info=self.makeTextInfo(textInfos.Point(x,y))
except NotImplementedError:
info=NVDAObjectTextInfo(self,textInfos.POSITION_FIRST)
except LookupError:
return
if config.conf["reviewCursor"]["followMouse"]:
api.setReviewPosition(info)
info.expand(info.unit_mouseChunk)
oldInfo=getattr(self,'_lastMouseTextInfoObject',None)
self._lastMouseTextInfoObject=info
if not oldInfo or info.__class__!=oldInfo.__class__ or info.compareEndPoints(oldInfo,"startToStart")!=0 or info.compareEndPoints(oldInfo,"endToEnd")!=0:
text=info.text
notBlank=False
if text:
for ch in text:
if not ch.isspace() and ch!=u'\ufffc':
notBlank=True
if notBlank:
if not speechWasCanceled:
speech.cancelSpeech()
speech.speakText(text)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:30,代码来源:__init__.py
示例5: wsrPanelHidden
def wsrPanelHidden(self, windowHandle):
global wsrAlternatesPanel, wsrSpellingPanel
if wsrAlternatesPanel is not None and windowHandle == wsrAlternatesPanel.windowHandle:
if wsrSpellingPanel is None:
speech.speakText("Closed alternates panel")
wsrAlternatesPanel = None
elif wsrSpellingPanel is not None and windowHandle == wsrSpellingPanel.windowHandle:
wsrSpellingPanel.cancelPoll()
speech.speakText("Closed spelling panel")
wsrSpellingPanel = None
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:10,代码来源:__init__.py
示例6: reportFocus
def reportFocus(self):
speech.speakObjectProperties(self,name=True,role=True)
info=self.makeTextInfo(textInfos.POSITION_CARET)
info.move(textInfos.UNIT_WORD,-1,endPoint="start")
try:
error=info._rangeObj.spellingErrors[1].text
except:
info.expand(textInfos.UNIT_STORY)
speech.speakText(info.text)
return
speech.speakText(error)
speech.speakSpelling(error)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:12,代码来源:winword.py
示例7: flushCurrentEntry
def flushCurrentEntry():
global currentEntry, autoFlushTimer
if autoFlushTimer is not None:
autoFlushTimer.Stop()
autoFlushTimer = None
start, text = currentEntry
text = text.replace("\r\n", "\n")
text = text.replace("\r", "\n")
while True:
i = text.find("\n")
if i == -1:
break
if i > 0:
speech.speakText(text[:i])
if text[i:i + 2] == "\n\n":
# Translators: The text which is spoken when a new paragraph is added.
speech.speakText(_("new paragraph"))
text = text[i + 2:]
else:
# Translators: The message spoken when a new line is entered.
speech.speakText(_("new line"))
text = text[i + 1:]
if text != "":
speech.speakText(text)
braille.handler.handleCaretMove(api.getFocusObject())
currentEntry = None
requestWSRShowHideEvents()
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:27,代码来源:__init__.py
示例8: reportFocus
def reportFocus(self):
# #4878: Excel specific code for speaking format changes on the focused object.
info=self.makeTextInfo(textInfos.POSITION_FIRST)
info.expand(textInfos.UNIT_CHARACTER)
formatField=textInfos.FormatField()
formatConfig=config.conf['documentFormatting']
for field in info.getTextWithFields(formatConfig):
if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField):
formatField.update(field.field)
if not hasattr(self.parent,'_formatFieldSpeechCache'):
self.parent._formatFieldSpeechCache={}
text=speech.getFormatFieldSpeech(formatField,attrsCache=self.parent._formatFieldSpeechCache,formatConfig=formatConfig) if formatField else None
if text:
speech.speakText(text)
super(ExcelCell,self).reportFocus()
开发者ID:JamaicanUser,项目名称:nvda,代码行数:15,代码来源:excel.py
示例9: poll
def poll(self, *args, **kwargs):
self.pollTimer = None
oldWord = self.previousWord or ""
newWord = self.word or ""
if newWord != oldWord:
self.previousWord = newWord
if len(newWord) > len(oldWord) and newWord[:len(oldWord)] == oldWord:
speech.speakSpelling(newWord[len(oldWord):])
elif newWord:
speech.speakText(newWord)
speech.speakSpelling(newWord)
elif oldWord:
# Translators: The text which is spoken when the spelling dialog is cleared.
speech.speakText(_("cleared"))
self.schedulePoll()
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:15,代码来源:__init__.py
示例10: handleInputCompositionEnd
def handleInputCompositionEnd(result):
import speech
import characterProcessing
from NVDAObjects.inputComposition import InputComposition
from NVDAObjects.behaviors import CandidateItem
focus=api.getFocusObject()
result=result.lstrip(u'\u3000 ')
curInputComposition=None
if isinstance(focus,InputComposition):
curInputComposition=focus
oldSpeechMode=speech.speechMode
speech.speechMode=speech.speechMode_off
eventHandler.executeEvent("gainFocus",focus.parent)
speech.speechMode=oldSpeechMode
elif isinstance(focus.parent,InputComposition):
#Candidate list is still up
curInputComposition=focus.parent
focus.parent=focus.parent.parent
if curInputComposition and not result:
result=curInputComposition.compositionString.lstrip(u'\u3000 ')
if result:
speech.speakText(result,symbolLevel=characterProcessing.SYMLVL_ALL)
开发者ID:bramd,项目名称:nvda,代码行数:22,代码来源:NVDAHelper.py
示例11: speakAndSpellWSRAlternatesPanelItem
def speakAndSpellWSRAlternatesPanelItem(obj):
text = getCleanedWSRAlternatesPanelItemName(obj)
speech.speakText(text)
speech.speakSpelling(text)
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:4,代码来源:__init__.py
示例12: event_selection
def event_selection(self):
speech.cancelSpeech()
speech.speakText(self.name)
if config.conf["notepadPp"]["brailleAutocompleteSuggestions"]:
braille.handler.message(u'⣏ %s ⣹' % self.name)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:5,代码来源:autocomplete.py
示例13: _reportNewText
def _reportNewText(self, line):
"""Report a line of new text.
"""
speech.speakText(line)
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:4,代码来源:behaviors.py
示例14: reportFocus
def reportFocus(self):
errorText=self.errorText
speech.speakObjectProperties(self,name=True,role=True)
if errorText:
speech.speakText(errorText)
speech.speakSpelling(errorText)
开发者ID:lpintes,项目名称:NVDA,代码行数:6,代码来源:winword.py
示例15: event_selection
def event_selection(self, obj, nextHandler):
if obj.role == controlTypes.ROLE_LISTITEM and isInWSRAlternatesPanel(obj):
speech.speakText(str(obj.positionInfo["indexInGroup"]))
speakAndSpellWSRAlternatesPanelItem(obj)
return
nextHandler()
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:6,代码来源:__init__.py
示例16: event_show
def event_show(self, obj, nextHandler):
global wsrAlternatesPanel, wsrSpellingPanel
#Phrases which need translated in this function:
# Translators: The text for "or say," Which is telling the user that they can say the next phrase.
orSay = _("Or say")
if isinstance(obj, WSRAlternatesPanel):
wsrAlternatesPanel = obj
speech.cancelSpeech()
speech.speakText(obj.name)
for descendant in obj.recursiveDescendants:
if controlTypes.STATE_INVISIBLE in descendant.states or controlTypes.STATE_INVISIBLE in descendant.parent.states:
continue
if descendant.role == controlTypes.ROLE_STATICTEXT:
speech.speakText(descendant.name)
elif descendant.role == controlTypes.ROLE_LINK:
speech.speakText(orSay)
speech.speakText(descendant.name)
elif descendant.role == controlTypes.ROLE_LISTITEM:
speech.speakText(str(descendant.positionInfo["indexInGroup"]))
speakWSRAlternatesPanelItem(descendant)
return
elif isinstance(obj, WSRSpellingPanel):
if wsrSpellingPanel is not None:
wsrSpellingPanel.cancelPoll()
wsrSpellingPanel = obj
wsrSpellingPanel.schedulePoll()
speech.cancelSpeech()
speech.speakText(obj.name)
for descendant in obj.recursiveDescendants:
if controlTypes.STATE_INVISIBLE in descendant.states or controlTypes.STATE_INVISIBLE in descendant.parent.states:
continue
if descendant.role == controlTypes.ROLE_STATICTEXT:
speech.speakText(descendant.name)
elif descendant.role == controlTypes.ROLE_LINK:
speech.speakText(orSay)
speech.speakText(descendant.name)
return
nextHandler()
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:38,代码来源:__init__.py
示例17: speakWSRAlternatesPanelItem
def speakWSRAlternatesPanelItem(obj):
text = getCleanedWSRAlternatesPanelItemName(obj)
speech.speakText(text)
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:3,代码来源:__init__.py
示例18: textDeleted
def textDeleted(hwnd, start, text):
# Translators: The message spoken when a piece of text is deleted.
speech.speakText(_("deleted %s" % text))
开发者ID:dictationbridge,项目名称:dictationbridge-nvda,代码行数:3,代码来源:__init__.py
注:本文中的speech.speakText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论