当前位置: 首页>>代码示例>>Python>>正文


Python speech.speakObject函数代码示例

本文整理汇总了Python中speech.speakObject函数的典型用法代码示例。如果您正苦于以下问题:Python speakObject函数的具体用法?Python speakObject怎么用?Python speakObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了speakObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: script_navigatorObject_current

	def script_navigatorObject_current(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			speech.speakMessage(_("no navigator object"))
			return
		if scriptHandler.getLastScriptRepeatCount()>=1:
			if curObject.TextInfo!=NVDAObjectTextInfo:
				textList=[]
				if curObject.name and isinstance(curObject.name, basestring) and not curObject.name.isspace():
					textList.append(curObject.name)
				try:
					info=curObject.makeTextInfo(textInfos.POSITION_SELECTION)
					if not info.isCollapsed:
						textList.append(info.text)
					else:
						info.expand(textInfos.UNIT_LINE)
						if not info.isCollapsed:
							textList.append(info.text)
				except (RuntimeError, NotImplementedError):
					# No caret or selection on this object.
					pass
			else:
				textList=[prop for prop in (curObject.name, curObject.value) if prop and isinstance(prop, basestring) and not prop.isspace()]
			text=" ".join(textList)
			if len(text)>0 and not text.isspace():
				if scriptHandler.getLastScriptRepeatCount()==1:
					speech.speakSpelling(text)
				else:
					if api.copyToClip(text):
						speech.speakMessage(_("%s copied to clipboard")%text)
		else:
			speech.speakObject(curObject,reason=speech.REASON_QUERY)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:32,代码来源:globalCommands.py

示例2: _moveToColumn

	def _moveToColumn(self, obj):
		if not obj:
			ui.message(_("edge of table"))
			return
		if obj is not self:
			# Use the focused copy of the row as the parent for all cells to make comparison faster.
			obj.parent = self
		api.setNavigatorObject(obj)
		speech.speakObject(obj, reason=controlTypes.REASON_FOCUS)
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:9,代码来源:behaviors.py

示例3: script_reportCurrentFocus

	def script_reportCurrentFocus(self,gesture):
		focusObject=api.getFocusObject()
		if isinstance(focusObject,NVDAObject):
			if scriptHandler.getLastScriptRepeatCount()==0:
				speech.speakObject(focusObject, reason=speech.REASON_QUERY)
			else:
				speech.speakSpelling(focusObject.name)
		else:
			speech.speakMessage(_("no focus"))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:9,代码来源:globalCommands.py

示例4: script_navigatorObject_toFocus

	def script_navigatorObject_toFocus(self,gesture):
		obj=api.getFocusObject()
		try:
			pos=obj.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError,RuntimeError):
			pos=obj.makeTextInfo(textInfos.POSITION_FIRST)
		api.setReviewPosition(pos)
		speech.speakMessage(_("move to focus"))
		speech.speakObject(obj,reason=speech.REASON_QUERY)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:9,代码来源:globalCommands.py

示例5: generateObjectSubtreeSpeech

def generateObjectSubtreeSpeech(obj,indexGen):
	index=indexGen.next()
	speech.speakObject(obj,reason=controlTypes.REASON_SAYALL,index=index)
	yield obj,index
	child=obj.simpleFirstChild
	while child:
		childSpeech=generateObjectSubtreeSpeech(child,indexGen)
		for r in childSpeech:
			yield r
		child=child.simpleNext
开发者ID:JRMeyer,项目名称:nvda,代码行数:10,代码来源:sayAllHandler.py

示例6: speakDescendantObjects

	def speakDescendantObjects(self,hashList=None):
		"""Speaks all the descendants of this object.
		"""
		if hashList is None:
			hashList=[]
		for child in self.children:
			h=hash(child)
			if h not in hashList:
				hashList.append(h)
				speech.speakObject(child)
				child.speakDescendantObjects(hashList=hashList)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:11,代码来源:__init__.py

示例7: script_navigatorObject_moveToObjectAtFlatReviewPosition

	def script_navigatorObject_moveToObjectAtFlatReviewPosition(self,gesture):
		pos=api.getReviewPosition()
		try:
			obj=pos.NVDAObjectAtStart
		except NotImplementedError:
			obj=None
		if obj and obj!=pos.obj:
			api.setNavigatorObject(obj)
			speech.speakObject(obj)
		else:
			speech.speakMessage(_("No object at flat review position"))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:11,代码来源:globalCommands.py

示例8: script_navigatorObject_firstChild

	def script_navigatorObject_firstChild(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			speech.speakMessage(_("no navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simpleFirstChild if simpleReviewMode else curObject.firstChild
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=speech.REASON_QUERY)
		else:
			speech.speakMessage(_("No children"))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:12,代码来源:globalCommands.py

示例9: event_treeInterceptor_gainFocus

	def event_treeInterceptor_gainFocus(self):
		speech.speakObject(self.rootNVDAObject, reason=controlTypes.REASON_FOCUS)
		try:
			info = self.makeTextInfo(textInfos.POSITION_SELECTION)
		except RuntimeError:
			pass
		else:
			if info.isCollapsed:
				info.expand(textInfos.UNIT_LINE)
				speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=controlTypes.REASON_CARET)
			else:
				speech.speakSelectionMessage(_("selected %s"), info.text)
			braille.handler.handleGainFocus(self)
			self.initAutoSelectDetection()
开发者ID:BabbageCom,项目名称:nvda,代码行数:14,代码来源:compoundDocuments.py

示例10: 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

示例11: readObjectsHelper_generator

def readObjectsHelper_generator(obj):
	levelsIndexMap={}
	updateObj=obj
	keepReading=True
	keepUpdating=True
	indexCount=0
	lastSpokenIndex=0
	endIndex=0
	while keepUpdating:
		while speech.isPaused:
			yield
			continue
		if keepReading:
			speech.speakObject(obj,index=indexCount,reason=speech.REASON_SAYALL)
			up=[]
			down=[]
			obj=obj.getNextInFlow(up=up,down=down)
			if not obj:
				endIndex=indexCount
				keepReading=False
			indexCount+=1
			levelsIndexMap[indexCount]=(len(up),len(down))
		spokenIndex=speech.getLastSpeechIndex()
		if spokenIndex is None:
			spokenIndex=0
		for count in range(spokenIndex-lastSpokenIndex):
			upLen,downLen=levelsIndexMap.get(lastSpokenIndex+count+1,(0,0))
			if upLen==0 and downLen==0:
				tones.beep(880,50)
			if upLen>0:
				for count in range(upLen+1):
					tones.beep(880*(1.25**count),50)
					time.sleep(0.025)
			if downLen>0:
				for count in range(downLen+1):
					tones.beep(880/(1.25**count),50)
					time.sleep(0.025)
			updateObj=updateObj.nextInFlow
			api.setNavigatorObject(updateObj)
		if not keepReading and spokenIndex>=endIndex:
			keepUpdating=False
		lastSpokenIndex=spokenIndex
		yield
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:43,代码来源:sayAllHandler.py

示例12: event_alert

	def event_alert(self):
		if not config.conf["presentation"]["reportHelpBalloons"]:
			return
		speech.speakObject(self, reason=controlTypes.REASON_FOCUS)
		# Ideally, we wouldn't use getBrailleTextForProperties directly.
		braille.handler.message(braille.getBrailleTextForProperties(name=self.name, role=self.role))
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:6,代码来源:behaviors.py

示例13: event_focusEntered

	def event_focusEntered(self):
		#for some reason, NVDA doesn't execute a focusEntered event for this object, so force it to do so
		speech.speakObject(self,reason=controlTypes.REASON_FOCUSENTERED)
开发者ID:mohammad-suliman,项目名称:visualStudioAddon,代码行数:3,代码来源:devenv.py

示例14: script_moveNavigatorObjectToMouse

	def script_moveNavigatorObjectToMouse(self,gesture):
		ui.message(_("Move navigator object to mouse"))
		obj=api.getMouseObject()
		api.setNavigatorObject(obj)
		speech.speakObject(obj)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:5,代码来源:globalCommands.py

示例15: script_changeItem

	def script_changeItem(self,gesture):
		gesture.send()
		if not isScriptWaiting():
			api.processPendingEvents()
			speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
			braille.handler.handleGainFocus(self)
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:6,代码来源:miranda32.py


注:本文中的speech.speakObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。