本文整理汇总了Python中speech.cancelSpeech函数的典型用法代码示例。如果您正苦于以下问题:Python cancelSpeech函数的具体用法?Python cancelSpeech怎么用?Python cancelSpeech使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cancelSpeech函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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()
示例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()
示例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()
示例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
示例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")
示例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()
示例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()
示例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)
示例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)
示例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
示例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
示例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)
示例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