• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python speech.speakTextInfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _tableMovementScriptHelper

	def _tableMovementScriptHelper(self, movement="next", axis=None):
		if isScriptWaiting():
			return
		formatConfig=config.conf["documentFormatting"].copy()
		formatConfig["reportTables"]=True
		formatConfig["includeLayoutTables"]=True
		try:
			tableID, origRow, origCol, origRowSpan, origColSpan = self._getTableCellCoords(self.selection)
		except LookupError:
			# Translators: The message reported when a user attempts to use a table movement command
			# when the cursor is not within a table.
			ui.message(_("Not in a table cell"))
			return

		try:
			info = self._getNearestTableCell(tableID, self.selection, origRow, origCol, origRowSpan, origColSpan, movement, axis)
		except LookupError:
			# Translators: The message reported when a user attempts to use a table movement command
			# but the cursor can't be moved in that direction because it is at the edge of the table.
			ui.message(_("Edge of table"))
			# Retrieve the cell on which we started.
			info = next(self._iterTableCells(tableID, row=origRow, column=origCol))

		speech.speakTextInfo(info,formatConfig=formatConfig,reason=controlTypes.REASON_CARET)
		info.collapse()
		self.selection = info
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:26,代码来源:__init__.py


示例2: script_caret_newLine

	def script_caret_newLine(self,gesture):
		try:
			info=self.makeTextInfo(textInfos.POSITION_CARET)
		except:
			gesture.send()
			return
		bookmark=info.bookmark
		gesture.send()
		caretMoved,newInfo=self._hasCaretMoved(bookmark) 
		if not caretMoved or not newInfo:
			return
		# newInfo.copy should be good enough here, but in MS Word we get strange results.
		try:
			lineInfo=self.makeTextInfo(textInfos.POSITION_CARET)
		except (RuntimeError,NotImplementedError):
			return
		lineInfo.expand(textInfos.UNIT_LINE)
		if not self.announceEntireNewLine: 
			lineInfo.setEndPoint(newInfo,"endToStart")
		if lineInfo.isCollapsed:
			lineInfo.expand(textInfos.UNIT_CHARACTER)
			onlyInitial=True
		else:
			onlyInitial=False
		speech.speakTextInfo(lineInfo,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET,onlyInitialFields=onlyInitial,suppressBlanks=True)
开发者ID:BabbageCom,项目名称:nvda,代码行数:25,代码来源:editableText.py


示例3: script_moveToParent

 def script_moveToParent(self, gesture):
     # Make sure we're in a editable control
     focus = api.getFocusObject()
     if focus.role != controlTypes.ROLE_EDITABLETEXT:
         ui.message("Not in an edit control.")
         return
     
     # Get the current indentation level 
     textInfo = focus.makeTextInfo(textInfos.POSITION_CARET)
     textInfo.expand(textInfos.UNIT_LINE)
     indentationLevel = len(textInfo.text) - len(textInfo.text.strip())
     onEmptyLine = len(textInfo.text) == 1 #1 because an empty line will have the \n character
     
     # Scan each line until we hit the start of the indentation block, the start of the edit area, or find a line with less indentation level
     found = False
     while textInfo.move(textInfos.UNIT_LINE, -2) == -2:
         textInfo.expand(textInfos.UNIT_LINE)
         newIndentation = len(textInfo.text) - len(textInfo.text.strip())
         
         # Skip over empty lines if we didn't start on one.
         if not onEmptyLine and len(textInfo.text) == 1:
             continue
         
         if newIndentation < indentationLevel:
             # Found it
             found = True
             textInfo.updateCaret()
             speech.speakTextInfo(textInfo, unit=textInfos.UNIT_LINE)
             break
     
     # If we didn't find it, tell the user
     if not found:
         ui.message("No parent of indentation block")
开发者ID:cafeventos,项目名称:nvda-indentation-navigation,代码行数:33,代码来源:indentation_navigation.py


示例4: _caretMovementScriptHelper

	def _caretMovementScriptHelper(self,gesture,unit,direction=None,posConstant=textInfos.POSITION_SELECTION,posUnit=None,posUnitEnd=False,extraDetail=False,handleSymbols=False):
		oldInfo=self.makeTextInfo(posConstant)
		info=oldInfo.copy()
		info.collapse(end=self.isTextSelectionAnchoredAtStart)
		if self.isTextSelectionAnchoredAtStart and not oldInfo.isCollapsed:
			info.move(textInfos.UNIT_CHARACTER,-1)
		if posUnit is not None:
			# expand and collapse to ensure that we are aligned with the end of the intended unit
			info.expand(posUnit)
			try:
				info.collapse(end=posUnitEnd)
			except RuntimeError:
				# MS Word has a "virtual linefeed" at the end of the document which can cause RuntimeError to be raised.
				# In this case it can be ignored.
				# See #7009
				pass
			if posUnitEnd:
				info.move(textInfos.UNIT_CHARACTER,-1)
		if direction is not None:
			info.expand(unit)
			info.collapse(end=posUnitEnd)
			if info.move(unit,direction)==0 and isinstance(self,DocumentWithPageTurns):
				try:
					self.turnPage(previous=direction<0)
				except RuntimeError:
					pass
				else:
					info=self.makeTextInfo(textInfos.POSITION_FIRST if direction>0 else textInfos.POSITION_LAST)
		self.selection=info
		info.expand(unit)
		if not willSayAllResume(gesture): speech.speakTextInfo(info,unit=unit,reason=controlTypes.REASON_CARET)
		if not oldInfo.isCollapsed:
			speech.speakSelectionChange(oldInfo,self.selection)
开发者ID:eklipse2009,项目名称:nvda,代码行数:33,代码来源:cursorManager.py


示例5: _caretMovementScriptHelper

	def _caretMovementScriptHelper(self,gesture,unit,direction=None,posConstant=textInfos.POSITION_SELECTION,posUnit=None,posUnitEnd=False,extraDetail=False,handleSymbols=False):
		oldInfo=self.makeTextInfo(posConstant)
		info=oldInfo.copy()
		info.collapse(end=not self._lastSelectionMovedStart)
		if not self._lastSelectionMovedStart and not oldInfo.isCollapsed:
			info.move(textInfos.UNIT_CHARACTER,-1)
		if posUnit is not None:
			info.expand(posUnit)
			info.collapse(end=posUnitEnd)
			if posUnitEnd:
				info.move(textInfos.UNIT_CHARACTER,-1)
		if direction is not None:
			info.expand(unit)
			info.collapse(end=posUnitEnd)
			if info.move(unit,direction)==0 and isinstance(self,DocumentWithPageTurns):
				try:
					self.turnPage(previous=direction<0)
				except RuntimeError:
					pass
				else:
					info=self.makeTextInfo(textInfos.POSITION_FIRST if direction>0 else textInfos.POSITION_LAST)
		self.selection=info
		info.expand(unit)
		if not willSayAllResume(gesture): speech.speakTextInfo(info,unit=unit,reason=controlTypes.REASON_CARET)
		if not oldInfo.isCollapsed:
			speech.speakSelectionChange(oldInfo,self.selection)
开发者ID:dnz3d4c,项目名称:nvda,代码行数:26,代码来源:cursorManager.py


示例6: script_review_currentWord

	def script_review_currentWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		scriptCount=scriptHandler.getLastScriptRepeatCount()
		if scriptCount==0:
			speech.speakTextInfo(info,reason=speech.REASON_CARET,unit=textInfos.UNIT_WORD)
		else:
			speech.speakSpelling(info.text,useCharacterDescriptions=bool(scriptCount>1))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:8,代码来源:globalCommands.py


示例7: script_review_startOfLine

	def script_review_startOfLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_CHARACTER)
		speech.speakMessage(_("left"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=speech.REASON_CARET)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:8,代码来源:globalCommands.py


示例8: script_tab

	def script_tab(self,gesture):
		oldBookmark=self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION).bookmark
		gesture.send()
		noTimeout,newInfo=self.rootNVDAObject._hasCaretMoved(oldBookmark,timeout=1)
		if not newInfo:
			return
		info=self.makeTextInfo(textInfos.POSITION_SELECTION)
		if not info.isCollapsed:
			speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
开发者ID:josephsl,项目名称:nvda4nvda,代码行数:9,代码来源:wordDocument.py


示例9: script_caret_moveByCell

	def script_caret_moveByCell(self,gesture):
		gesture.send()
		info=self.makeTextInfo(textInfos.POSITION_SELECTION)
		inTable=info._rangeObj.tables.count>0
		isCollapsed=info.isCollapsed
		if inTable:
			info.expand(textInfos.UNIT_CELL)
			speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
			braille.handler.handleCaretMove(self)
开发者ID:eklipse2009,项目名称:nvda,代码行数:9,代码来源:winword.py


示例10: script_review_previousLine

	def script_review_previousLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		res=info.move(textInfos.UNIT_LINE,-1)
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_LINE)
		if res==0:
			speech.speakMessage(_("top"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=speech.REASON_CARET)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:10,代码来源:globalCommands.py


示例11: script_review_nextWord

	def script_review_nextWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		info.collapse()
		res=info.move(textInfos.UNIT_WORD,1)
		api.setReviewPosition(info.copy())
		info.expand(textInfos.UNIT_WORD)
		if res==0:
			speech.speakMessage(_("bottom"))
		speech.speakTextInfo(info,reason=speech.REASON_CARET,unit=textInfos.UNIT_WORD)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:10,代码来源:globalCommands.py


示例12: report

	def report(self,readUnit=None):
		info=self.textInfo
		if readUnit:
			fieldInfo = info.copy()
			info.collapse()
			info.move(readUnit, 1, endPoint="end")
			if info.compareEndPoints(fieldInfo, "endToEnd") > 0:
				# We've expanded past the end of the field, so limit to the end of the field.
				info.setEndPoint(fieldInfo, "endToEnd")
		speech.speakTextInfo(info, reason=controlTypes.REASON_FOCUS)
开发者ID:pcguruuu,项目名称:git-git.nvaccess.org-nvda,代码行数:10,代码来源:browseMode.py


示例13: script_previousColumn

	def script_previousColumn(self,gesture):
		info=self.makeTextInfo("caret")
		if not info._rangeObj.Information(wdWithInTable):
 			speech.speakMessage(_("not in table"))
			return
		if info._moveInTable(-1,0):
			info.updateCaret()
			info.expand(textInfos.UNIT_CELL)
			speech.speakTextInfo(info,reason=speech.REASON_CARET)
		else:
			speech.speakMessage(_("edge of table"))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:11,代码来源:winword.py


示例14: _changePageScriptHelper

	def _changePageScriptHelper(self,gesture,previous=False):
		if isScriptWaiting():
			return
		try:
			self.turnPage(previous=previous)
		except RuntimeError:
			return
		info=self.makeTextInfo(textInfos.POSITION_FIRST)
		self.selection=info
		info.expand(textInfos.UNIT_LINE)
		if not willSayAllResume(gesture): speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
开发者ID:JRMeyer,项目名称:nvda,代码行数:11,代码来源:kindle.py


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


示例16: event_pageChange

	def event_pageChange(self, obj, nextHandler):
		if self.pageChangeAlreadyHandled:
			# This page change has already been handled.
			self.pageChangeAlreadyHandled = False
			return
		info = self.makeTextInfo(textInfos.POSITION_FIRST)
		self.selection = info
		if not self.rootNVDAObject.hasFocus:
			# Don't report anything if the book area isn't focused.
			return
		info.expand(textInfos.UNIT_LINE)
		speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=controlTypes.REASON_CARET)
开发者ID:JRMeyer,项目名称:nvda,代码行数:12,代码来源:kindle.py


示例17: script_navigatorObject_moveToFlatReviewAtObjectPosition

	def script_navigatorObject_moveToFlatReviewAtObjectPosition(self,gesture):
		obj=api.getNavigatorObject()
		pos=obj.flatReviewPosition
		if pos:
			api.setReviewPosition(pos)
			pos=pos.copy()
			obj=api.getNavigatorObject()
			speech.speakObjectProperties(obj,name=True,role=True)
			pos.expand(textInfos.UNIT_LINE)
			speech.speakTextInfo(pos)
		else:
			speech.speakMessage(_("No flat review for this object"))
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:12,代码来源:globalCommands.py


示例18: _caretScriptPostMovedHelper

	def _caretScriptPostMovedHelper(self, speakUnit):
		if isScriptWaiting():
			return
		try:
			info = self.makeTextInfo(textInfos.POSITION_CARET)
		except:
			return
		if config.conf["reviewCursor"]["followCaret"] and api.getNavigatorObject() is self:
			api.setReviewPosition(info.copy())
		if speakUnit:
			info.expand(speakUnit)
			speech.speakTextInfo(info, unit=speakUnit, reason=speech.REASON_CARET)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:12,代码来源:editableText.py


示例19: _caretScriptPostMovedHelper

	def _caretScriptPostMovedHelper(self, speakUnit, gesture, info=None):
		if isScriptWaiting():
			return
		if not info:
			try:
				info = self.makeTextInfo(textInfos.POSITION_CARET)
			except:
				return
		review.handleCaretMove(info)
		if speakUnit and not willSayAllResume(gesture):
			info.expand(speakUnit)
			speech.speakTextInfo(info, unit=speakUnit, reason=controlTypes.REASON_CARET)
		braille.handler.handleCaretMove(self)
开发者ID:lpintes,项目名称:NVDA,代码行数:13,代码来源:editableText.py


示例20: event_treeInterceptor_gainFocus

	def event_treeInterceptor_gainFocus(self):
		braille.handler.handleGainFocus(self)
		self.rootNVDAObject.reportFocus()
		if not self.hadFocusOnce:
			self.hadFocusOnce=True
			self.reportNewSlide()
		else:
			info = self.selection
			if not info.isCollapsed:
				speech.speakSelectionMessage(_("selected %s"), info.text)
			else:
				info.expand(textInfos.UNIT_LINE)
				speech.speakTextInfo(info, reason=controlTypes.REASON_CARET, unit=textInfos.UNIT_LINE)
开发者ID:BabbageCom,项目名称:nvda,代码行数:13,代码来源:powerpnt.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python say.text_to_say函数代码示例发布时间:2022-05-27
下一篇:
Python speech.speakText函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap