本文整理汇总了Python中speech.cancelSpeech函数的典型用法代码示例。如果您正苦于以下问题:Python cancelSpeech函数的具体用法?Python cancelSpeech怎么用?Python cancelSpeech使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cancelSpeech函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: event_UIA_elementSelected
def event_UIA_elementSelected(self, obj, nextHandler):
# #7273: When this is fired on categories, the first emoji from the new category is selected but not announced.
# Therefore, move the navigator object to that item if possible.
# However, in recent builds, name change event is also fired.
# For consistent experience, report the new category first by traversing through controls.
# #8189: do not announce candidates list itself (not items), as this is repeated each time candidate items are selected.
if obj.UIAElement.cachedAutomationID == "CandidateList": return
speech.cancelSpeech()
# Sometimes clipboard candidates list gets selected, so ask NvDA to descend one more level.
if obj.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemsList":
obj = obj.firstChild
candidate = obj
# Sometimes, due to bad tree traversal, something other than the selected item sees this event.
parent = obj.parent
if obj.UIAElement.cachedClassName == "ListViewItem" and isinstance(parent, UIA) and parent.UIAElement.cachedAutomationID != "TEMPLATE_PART_ClipboardItemsList":
# The difference between emoji panel and suggestions list is absence of categories/emoji separation.
# Turns out automation ID for the container is different, observed in build 17666 when opening clipboard copy history.
candidate = obj.parent.previous
if candidate is not None:
# Emoji categories list.
ui.message(candidate.name)
obj = candidate.firstChild
if obj is not None:
api.setNavigatorObject(obj)
obj.reportFocus()
braille.handler.message(braille.getBrailleTextForProperties(name=obj.name, role=obj.role, positionInfo=obj.positionInfo))
# Cache selected item.
self._recentlySelected = obj.name
else:
# Translators: presented when there is no emoji when searching for one in Windows 10 Fall Creators Update and later.
ui.message(_("No emoji"))
nextHandler()
开发者ID:MarcoZehe,项目名称:nvda,代码行数:32,代码来源:windowsinternal_composableshell_experiences_textinput_inputapp.py
示例3: event_gainFocus
def event_gainFocus(self):
if mouseHandler.lastMouseEventTime < time.time() - 0.2:
# This focus change was not caused by a mouse event.
# If the mouse is on another toolbar control, the notification area toolbar will rudely
# bounce the focus back to the object under the mouse after a brief pause.
# Moving the mouse to the focus object isn't a good solution because
# sometimes, the focus can't be moved away from the object under the mouse.
# Therefore, move the mouse out of the way.
winUser.setCursorPos(0, 0)
if self.role == controlTypes.ROLE_TOOLBAR:
# Sometimes, the toolbar itself receives the focus instead of the focused child.
# However, the focused child still has the focused state.
for child in self.children:
if child.hasFocus:
# Redirect the focus to the focused child.
eventHandler.executeEvent("gainFocus", child)
return
# We've really landed on the toolbar itself.
# This was probably caused by moving the mouse out of the way in a previous focus event.
# This previous focus event is no longer useful, so cancel speech.
speech.cancelSpeech()
if eventHandler.isPendingEvents("gainFocus"):
return
super(NotificationArea, self).event_gainFocus()
开发者ID:BabbageCom,项目名称:nvda,代码行数:26,代码来源:explorer.py
示例4: event_valueChange
def event_valueChange(self, obj, nextHandler):
#log.info("valueChange %s" % self.getInfo(obj))
if obj.windowClassName == 'ComboBox' and obj.role == oleacc.ROLE_SYSTEM_TOOLTIP:
api.setFocusObject(obj)
speech.cancelSpeech()
updateLocations()
nextHandler()
开发者ID:nvdajp,项目名称:focusHighlight,代码行数:7,代码来源:focusHighlight.py
示例5: script_disconnectAll
def script_disconnectAll(self, gesture):
ui.message(_("Disconnecting..."))
speechMode = speech.speechMode
speech.speechMode = 0
wx.CallAfter(self._samContextMenu, 8)
time.sleep(0.5)
speech.speechMode = speechMode
speech.cancelSpeech()
开发者ID:josephsl,项目名称:stationPlaylist,代码行数:8,代码来源:encoders.py
示例6: _metadataAnnouncerInternal
def _metadataAnnouncerInternal(status, startup=False):
import nvwave, queueHandler, speech
if not startup: speech.cancelSpeech()
queueHandler.queueFunction(queueHandler.eventQueue, ui.message, status)
nvwave.playWaveFile(os.path.join(os.path.dirname(__file__), "SPL_Metadata.wav"))
# #51 (18.03/15.14-LTS): close link to metadata announcer thread when finished.
global _earlyMetadataAnnouncer
_earlyMetadataAnnouncer = None
开发者ID:josephsl,项目名称:stationPlaylist,代码行数:8,代码来源:splmisc.py
示例7: onEndSession
def onEndSession(evt):
# NVDA will be terminated as soon as this function returns, so save configuration if appropriate.
config.saveOnExit()
speech.cancelSpeech()
if not globalVars.appArgs.minimal and config.conf["general"]["playStartAndExitSounds"]:
try:
nvwave.playWaveFile("waves\\exit.wav",async=False)
except:
pass
log.info("Windows session ending")
开发者ID:nishimotz,项目名称:nvda,代码行数:10,代码来源:core.py
示例8: event_UIA_elementSelected
def event_UIA_elementSelected(self):
# Build 17600 series introduces Sets, a way to group apps into tabs.
# #45: unfortunately, the start page for this (an embedded searchui process inside Edge) says controller for list is empty when in fact it isn't.
# Thankfully, it is easy to spot them: if a link is next to results list, then this is the embedded searchui results list.
focusControllerFor=api.getFocusObject().controllerFor
announceSuggestions = ((len(focusControllerFor)>0 and focusControllerFor[0].appModule is self.appModule and self.name) or self.parent.next is not None)
if announceSuggestions:
speech.cancelSpeech()
api.setNavigatorObject(self)
self.reportFocus()
开发者ID:josephsl,项目名称:wintenApps,代码行数:10,代码来源:searchui.py
示例9: event_stateChange
def event_stateChange(self, obj, nextHandler):
if obj.role == controlTypes.ROLE_DOCUMENT and controlTypes.STATE_BUSY in obj.states and winUser.isWindowVisible(obj.windowHandle) and obj.isInForeground:
statusBar = api.getStatusBar()
if statusBar:
statusText = api.getStatusBarText(statusBar)
speech.cancelSpeech()
speech.speakMessage(controlTypes.speechStateLabels[controlTypes.STATE_BUSY])
speech.speakMessage(statusText)
return
nextHandler()
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:10,代码来源:firefox.py
示例10: event_stateChange
def event_stateChange(self):
states=self.states
focus=api.getFocusObject()
if (focus.role==controlTypes.ROLE_EDITABLETEXT or focus.role==controlTypes.ROLE_BUTTON) and controlTypes.STATE_SELECTED in states and controlTypes.STATE_INVISIBLE not in states and controlTypes.STATE_UNAVAILABLE not in states and controlTypes.STATE_OFFSCREEN not in states:
speech.cancelSpeech()
text=self.name
# Some newer versions of Outlook don't put the contact as the name of the listItem, rather it is on the parent
if not text:
text=self.parent.name
ui.message(text)
开发者ID:BabbageCom,项目名称:nvda,代码行数:10,代码来源:outlook.py
示例11: moveToBookmark
def moveToBookmark(position):
obj = api.getFocusObject()
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor, BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj = treeInterceptor
bookmark = Offsets(position, position)
info = obj.makeTextInfo(bookmark)
info.updateSelection()
review.handleCaretMove(info)
speech.cancelSpeech()
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
开发者ID:nvdaes,项目名称:placeMarkers,代码行数:12,代码来源:__init__.py
示例12: script_speechMode
def script_speechMode(self,gesture):
curMode=speech.speechMode
speech.speechMode=speech.speechMode_talk
newMode=(curMode+1)%3
if newMode==speech.speechMode_off:
name=_("off")
elif newMode==speech.speechMode_beeps:
name=_("beeps")
elif newMode==speech.speechMode_talk:
name=_("talk")
speech.cancelSpeech()
ui.message(_("speech mode %s")%name)
speech.speechMode=newMode
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:13,代码来源:globalCommands.py
示例13: doFindText
def doFindText(self,text,reverse=False):
if not text:
return
info=self.makeTextInfo(textInfos.POSITION_CARET)
res=info.find(text,reverse=reverse)
if res:
self.selection=info
speech.cancelSpeech()
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
else:
wx.CallAfter(gui.messageBox,_('text "%s" not found')%text,_("Find Error"),wx.OK|wx.ICON_ERROR)
CursorManager._lastFindText=text
开发者ID:lpintes,项目名称:NVDA,代码行数:13,代码来源:cursorManager.py
示例14: event_stateChange
def event_stateChange(self):
# iTunes has indicated that a page has died and been replaced by a new one.
focus = api.getFocusObject()
if not winUser.isDescendantWindow(self.windowHandle, focus.windowHandle):
return
# The new page has the same event params, so we must bypass NVDA's IAccessible caching.
obj = NVDAObjects.IAccessible.getNVDAObjectFromEvent(focus.windowHandle, winUser.OBJID_CLIENT, 0)
if not obj:
return
if focus.treeInterceptor:
speech.cancelSpeech()
treeInterceptorHandler.killTreeInterceptor(focus.treeInterceptor)
eventHandler.queueEvent("gainFocus",obj)
开发者ID:lpintes,项目名称:NVDA,代码行数:13,代码来源:itunes.py
示例15: doFindText
def doFindText(self,text,reverse=False):
if not text:
return
info=self.makeTextInfo(textInfos.POSITION_CARET)
res=info.find(text,reverse=reverse)
if res:
self.selection=info
speech.cancelSpeech()
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=speech.REASON_CARET)
else:
errorDialog=gui.scriptUI.MessageDialog(_("text \"%s\" not found")%text,title=_("Find Error"),style=gui.scriptUI.wx.OK|gui.scriptUI.wx.ICON_ERROR)
errorDialog.run()
CursorManager._lastFindText=text
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:14,代码来源:cursorManager.py
示例16: event_stateChange
def event_stateChange(self):
# iTunes has indicated that a page has died and been replaced by a new one.
# #5191: This is actually fired on the "iTunesWebViewControl" parent,
# but AccessibleObjectFromEvent on this window returns the WebKit document as of iTunes 12.
focus = api.getFocusObject()
if self.windowHandle != focus.windowHandle:
return
# The new page has the same event params, so we must bypass NVDA's IAccessible caching.
obj = NVDAObjects.IAccessible.getNVDAObjectFromEvent(focus.windowHandle, winUser.OBJID_CLIENT, 0)
if not obj:
return
if focus.treeInterceptor:
speech.cancelSpeech()
treeInterceptorHandler.killTreeInterceptor(focus.treeInterceptor)
eventHandler.queueEvent("gainFocus",obj)
开发者ID:BabbageCom,项目名称:nvda,代码行数:15,代码来源:itunes.py
示例17: doFindText
def doFindText(text, reverse=False, caseSensitive=False):
if not text:
return
obj=api.getFocusObject()
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor, BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
obj.doFindText(text=text, reverse=reverse, caseSensitive=caseSensitive)
elif obj.role != controlTypes.ROLE_EDITABLETEXT:
return
else:
CursorManager._lastFindText = text
CursorManager._lastCaseSensitivity = caseSensitive
try:
info=obj.makeTextInfo(textInfos.POSITION_CARET)
except (NotImplementedError, RuntimeError):
info=obj.makeTextInfo(textInfos.POSITION_FIRST)
try:
res=info.find(text,reverse=reverse, caseSensitive=caseSensitive)
except WindowsError:
wx.CallAfter(gui.messageBox,
# Message translated in NVDA core.
translate('text "%s" not found') % text,
# Message translated in NVDA core.
translate("Find Error"),
wx.OK|wx.ICON_ERROR)
except:
if api.copyToClip(text):
# Translators: message presented when a string of text has been copied to the clipboard.
ui.message(_("%s copied to clipboard") % text)
return
if res:
if hasattr(obj,'selection'):
obj.selection=info
else:
info.updateCaret()
speech.cancelSpeech()
info.move(textInfos.UNIT_LINE,1,endPoint="end")
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
else:
wx.CallAfter(gui.messageBox,
# Message translated in NVDA core.
translate('text "%s" not found') % text,
# Message translated in NVDA core.
translate("Find Error"),
wx.OK|wx.ICON_ERROR)
开发者ID:nvdaes,项目名称:placeMarkers,代码行数:46,代码来源:__init__.py
示例18: moveTo
def moveTo(self,x,y,new=False,unit=textInfos.UNIT_LINE):
obj=api.getDesktopObject().objectFromPoint(x,y)
prevObj=None
while obj and obj.beTransparentToMouse:
prevObj=obj
obj=obj.parent
if not obj or (obj.presentationType!=obj.presType_content and obj.role!=controlTypes.ROLE_PARAGRAPH):
obj=prevObj
if not obj:
return
hasNewObj=False
if obj!=self._obj:
self._obj=obj
hasNewObj=True
if self.updateReview:
api.setNavigatorObject(obj)
else:
obj=self._obj
pos=None
if obj.treeInterceptor:
try:
pos=obj.treeInterceptor.makeTextInfo(obj)
except LookupError:
pos=None
if pos:
obj=obj.treeInterceptor.rootNVDAObject
if hasNewObj and self._obj and obj.treeInterceptor is self._obj.treeInterceptor:
hasNewObj=False
if not pos:
try:
pos=obj.makeTextInfo(textInfos.Point(x,y))
except (NotImplementedError,LookupError):
pass
if pos: pos.expand(unit)
if pos and self.updateReview:
api.setReviewPosition(pos)
speechCanceled=False
if hasNewObj:
speech.cancelSpeech()
speechCanceled=True
speech.speakObject(obj)
if pos and (new or not self._pos or pos.__class__!=self._pos.__class__ or pos.compareEndPoints(self._pos,"startToStart")!=0 or pos.compareEndPoints(self._pos,"endToEnd")!=0):
self._pos=pos
if not speechCanceled:
speech.cancelSpeech()
speech.speakTextInfo(pos,reason=controlTypes.REASON_CARET)
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:46,代码来源:screenExplorer.py
示例19: 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
示例20: event_selection
def event_selection(self):
if not self.appModule.selectedItem:
api.getFocusObject().event_suggestionsOpened()
# This is to ease finding the elp document
if self.appModule.selectedItem != self:
self.appModule.selectedItem = self
# If autocompletion popup is open and you write some text in the
# document, the selection event is not fired. For some reason, neither
# nameChange, so we need this check:
if self.appModule.selectedItemName != self.name:
self.appModule.selectedItemName = self.name
speech.cancelSpeech()
# Reporting as focused should be sufficient
self.reportFocus()
# I picked up this from UIA SuggestionItem for rendering in braille.
# Simply calling `reportFocus` doesn't outputs the text to braille devices
# and reporting with `ui.message` needs an extra translation string when reporting position info
braille.handler.message(
braille.getBrailleTextForProperties(name=self.name,
role=self.role, position=self.positionInfo))
开发者ID:ehollig,项目名称:nvda,代码行数:24,代码来源:eclipse.py
注:本文中的speech.cancelSpeech函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论