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


Python tones.beep函数代码示例

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


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

示例1: playAudioCoordinates

def playAudioCoordinates(x, y, screenWidth, screenHeight, screenMinPos, detectBrightness=True,blurFactor=0):
	""" play audio coordinates:
	- left to right adjusting the volume between left and right speakers
	- top to bottom adjusts the pitch of the sound
	- brightness adjusts the volume of the sound
	Coordinates (x, y) are absolute, and can be negative.
	"""

	# make relative to (0,0) and positive
	x = x - screenMinPos.x
	y = y - screenMinPos.y

	minPitch=config.conf['mouse']['audioCoordinates_minPitch']
	maxPitch=config.conf['mouse']['audioCoordinates_maxPitch']
	curPitch=minPitch+((maxPitch-minPitch)*((screenHeight-y)/float(screenHeight)))
	if detectBrightness:
		startX=min(max(x-blurFactor,0),screenWidth)+screenMinPos.x
		startY=min(max(y-blurFactor,0),screenHeight)+screenMinPos.y
		width=min(blurFactor+1,screenWidth)
		height=min(blurFactor+1,screenHeight)
		grey=screenBitmap.rgbPixelBrightness(scrBmpObj.captureImage( startX, startY, width, height)[0][0])
		brightness=grey/255.0
		minBrightness=config.conf['mouse']['audioCoordinates_minVolume']
		maxBrightness=config.conf['mouse']['audioCoordinates_maxVolume']
		brightness=(brightness*(maxBrightness-minBrightness))+minBrightness
	else:
		brightness=config.conf['mouse']['audioCoordinates_maxVolume']
	leftVolume=int((85*((screenWidth-float(x))/screenWidth))*brightness)
	rightVolume=int((85*(float(x)/screenWidth))*brightness)
	tones.beep(curPitch,40,left=leftVolume,right=rightVolume)
开发者ID:bramd,项目名称:nvda,代码行数:30,代码来源:mouseHandler.py

示例2: event_valueChange

	def event_valueChange(self):
		pbConf=config.conf["presentation"]["progressBarUpdates"]
		states=self.states
		if pbConf["progressBarOutputMode"]=="off" or controlTypes.STATE_INVISIBLE in states or controlTypes.STATE_OFFSCREEN in states:
			return super(ProgressBar,self).event_valueChange()
		val=self.value
		try:
			percentage = min(max(0.0, float(val.strip("%\0"))), 100.0)
		except (AttributeError, ValueError):
			log.debugWarning("Invalid value: %r" % val)
			return super(ProgressBar, self).event_valueChange()
		braille.handler.handleUpdate(self)
		if not pbConf["reportBackgroundProgressBars"] and not self.isInForeground:
			return
		try:
			left,top,width,height=self.location
		except:
			left=top=width=height=0
		x=left+(width/2)
		y=top+(height/2)
		lastBeepProgressValue=self.progressValueCache.get("beep,%d,%d"%(x,y),None)
		if pbConf["progressBarOutputMode"] in ("beep","both") and (lastBeepProgressValue is None or abs(percentage-lastBeepProgressValue)>=pbConf["beepPercentageInterval"]):
			tones.beep(pbConf["beepMinHZ"]*2**(percentage/25.0),40)
			self.progressValueCache["beep,%d,%d"%(x,y)]=percentage
		lastSpeechProgressValue=self.progressValueCache.get("speech,%d,%d"%(x,y),None)
		if pbConf["progressBarOutputMode"] in ("speak","both") and (lastSpeechProgressValue is None or abs(percentage-lastSpeechProgressValue)>=pbConf["speechPercentageInterval"]):
			queueHandler.queueFunction(queueHandler.eventQueue,speech.speakMessage,_("%d percent")%percentage)
			self.progressValueCache["speech,%d,%d"%(x,y)]=percentage
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:28,代码来源:behaviors.py

示例3: find

	def find(self, text):
		"""Find a window with the supplied text in its title.
		If the text isn't found in any title, search the text of consoles."""
		consoles = set()
		text = text.lower()
		for c in api.getDesktopObject().children:
			name = c.name
			if name is None:
				continue
			if text in name.lower():
				focus(c.windowHandle)
				return
			elif c.windowClassName == u'ConsoleWindowClass':
				consoles.add(c)

		#We didn't find the search text in the title, start searching consoles
		current_console = winConsoleHandler.consoleObject
		# If our current console is the one with the text in it, presumably we want another one, and if one isn't found, we'll refocus anyway
		if current_console is not None:
			consoles.remove(current_console)
		for console in consoles:
			#We assume this can't fail
			console_text = get_console_text(console)
			if text in console_text.lower():
				focus(console.windowHandle)
				return
		else: #No consoles found
			if current_console:
				winConsoleHandler.connectConsole(current_console)
				if current_console == api.getFocusObject():
					current_console.startMonitoring() #Keep echoing if we didn't switch
		tones.beep(300, 150)
开发者ID:ctoth,项目名称:jumpToWindow,代码行数:32,代码来源:jumpToWindow.py

示例4: done

	def done(self):
		self.timer.Stop()
		pbConf = config.conf["presentation"]["progressBarUpdates"]
		if pbConf["progressBarOutputMode"] in ("beep", "both") and (pbConf["reportBackgroundProgressBars"] or self.IsActive()):
			tones.beep(1760, 40)
		self.Hide()
		self.Destroy()
开发者ID:ehollig,项目名称:nvda,代码行数:7,代码来源:__init__.py

示例5: _speakSpellingGen

def _speakSpellingGen(text,locale,useCharacterDescriptions):
	textLength=len(text)
	synth=getSynth()
	synthConfig=config.conf["speech"][synth.name]
	for count,char in enumerate(text): 
		uppercase=char.isupper()
		charDesc=None
		if useCharacterDescriptions:
			from characterProcessing import getCharacterDescription
			charDesc=getCharacterDescription(locale,char.lower())
		if charDesc:
			char=charDesc
		else:
			char=processSymbol(char)
		if uppercase and synthConfig["sayCapForCapitals"]:
			char=_("cap %s")%char
		if uppercase and synth.isSupported("pitch") and synthConfig["raisePitchForCapitals"]:
			oldPitch=synthConfig["pitch"]
			synth.pitch=max(0,min(oldPitch+synthConfig["capPitchChange"],100))
		index=count+1
		log.io("Speaking character %r"%char)
		if len(char) == 1 and synthConfig["useSpellingFunctionality"]:
			synth.speakCharacter(char,index=index)
		else:
			synth.speakText(char,index=index)
		if uppercase and synth.isSupported("pitch") and synthConfig["raisePitchForCapitals"]:
			synth.pitch=oldPitch
		while textLength>1 and (isPaused or getLastSpeechIndex()!=index):
			yield
			yield
		if uppercase and  synthConfig["beepForCapitals"]:
			tones.beep(2000,50)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:32,代码来源:speech.py

示例6: script_clockLayerCommands

	def script_clockLayerCommands(self, gesture):
		if self.clockLayerModeActive:
			self.script_error(gesture)
			return
		self.bindGestures(self.__clockLayerGestures)
		self.clockLayerModeActive=True
		tones.beep(100, 10)
开发者ID:Oliver2213,项目名称:clock,代码行数:7,代码来源:__init__.py

示例7: speakSpelling

def speakSpelling(text,locale=None,useCharacterDescriptions=False):
	global beenCanceled, _speakSpellingGenID
	import speechViewer
	if speechViewer.isActive:
		speechViewer.appendText(text)
	if speechMode==speechMode_off:
		return
	elif speechMode==speechMode_beeps:
		tones.beep(config.conf["speech"]["beepSpeechModePitch"],speechMode_beeps_ms)
		return
	if isPaused:
		cancelSpeech()
	beenCanceled=False
	from languageHandler import getLanguage
	locale=getLanguage()
	if not isinstance(text,basestring) or len(text)==0:
		return getSynth().speakText(processSymbol(""))
	if not text.isspace():
		text=text.rstrip()
	gen=_speakSpellingGen(text,locale,useCharacterDescriptions)
	try:
		# Speak the first character before this function returns.
		next(gen)
	except StopIteration:
		return
	_speakSpellingGenID=queueHandler.registerGeneratorObject(gen)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:26,代码来源:speech.py

示例8: event_typedCharacter

	def event_typedCharacter(self, ch):
		super(EditWindow, self).event_typedCharacter(ch)
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		textInfo = self.makeTextInfo(textInfos.POSITION_CARET)
		textInfo.expand(textInfos.UNIT_LINE)
		if textInfo.bookmark.endOffset - textInfo.bookmark.startOffset >= config.conf["notepadPp"]["maxLineLength"]:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:8,代码来源:editWindow.py

示例9: script_reportLineOverflow

	def script_reportLineOverflow(self, gesture):
		if self.appModule.isAutocomplete:
			gesture.send()
			return
		self.script_caret_moveByLine(gesture)
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		info = self.makeTextInfo(textInfos.POSITION_CARET)
		info.expand(textInfos.UNIT_LINE)
		if len(info.text.strip('\r\n\t ')) > config.conf["notepadPp"]["maxLineLength"]:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:11,代码来源:editWindow.py

示例10: speakingHook

def speakingHook(d):
	percentage=0
	frequency=100
	if d['status'] == 'downloading':
		percentage=int((float(d['downloaded_bytes'])/d['total_bytes'])*100)
		frequency=100+percentage
		tones.beep(frequency, 50)
	elif d['status'] == 'finished':
		ui.message(_("Download complete. Converting video."))
	elif d['status'] == 'error':
		ui.message(_("Download error."))
开发者ID:Oliver2213,项目名称:NVDAYoutube-dl,代码行数:11,代码来源:__init__.py

示例11: event_UIA_notification

	def event_UIA_notification(self, obj, nextHandler, notificationKind=None, notificationProcessing=None, displayString=None, activityId=None):
		# Introduced in Version 1709, to be treated as a notification event.
		self.uiaDebugLogging(obj, "notification")
		if isinstance(obj, UIA) and globalVars.appArgs.debugLogging:
			log.debug("W10: UIA notification: sender: %s, notification kind: %s, notification processing: %s, display string: %s, activity ID: %s"%(obj.UIAElement,notificationKind,notificationProcessing,displayString,activityId))
			# Play a debug tone if and only if notifications come from somewhere other than the active app.
			if obj.appModule != api.getFocusObject().appModule:
				import tones
				# For debugging purposes.
				tones.beep(500, 100)
		nextHandler()
开发者ID:josephsl,项目名称:wintenApps,代码行数:11,代码来源:__init__.py

示例12: event_typedCharacter

    def event_typedCharacter(self, ch):
        speech.speakTypedCharacters(ch)
        import winUser

        if (
            config.conf["keyboard"]["beepForLowercaseWithCapslock"]
            and ch.islower()
            and winUser.getKeyState(winUser.VK_CAPITAL) & 1
        ):
            import tones

            tones.beep(3000, 40)
开发者ID:rbmendoza,项目名称:nvda,代码行数:12,代码来源:__init__.py

示例13: event_caret

	def event_caret(self):
		super(EditWindow, self).event_caret()
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		caretInfo = self.makeTextInfo(textInfos.POSITION_CARET)
		lineStartInfo = self.makeTextInfo(textInfos.POSITION_CARET).copy()
		caretInfo.expand(textInfos.UNIT_CHARACTER)
		lineStartInfo.expand(textInfos.UNIT_LINE)
		caretPosition = caretInfo.bookmark.startOffset -lineStartInfo.bookmark.startOffset
		#Is it not a blank line, and are we further in the line than the marker position?
		if caretPosition > config.conf["notepadPp"]["maxLineLength"] -1 and caretInfo.text not in ['\r', '\n']:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:12,代码来源:editWindow.py

示例14: event_typedCharacter

	def event_typedCharacter(self,ch):
		if config.conf["documentFormatting"]["reportSpellingErrors"] and config.conf["keyboard"]["alertForSpellingErrors"] and (
			# Not alpha, apostrophe or control.
			ch.isspace() or (ch >= u" " and ch not in u"'\x7f" and not ch.isalpha())
		):
			# Reporting of spelling errors is enabled and this character ends a word.
			self._reportErrorInPreviousWord()
		speech.speakTypedCharacters(ch)
		import winUser
		if config.conf["keyboard"]["beepForLowercaseWithCapslock"] and ch.islower() and winUser.getKeyState(winUser.VK_CAPITAL)&1:
			import tones
			tones.beep(3000,40)
开发者ID:jhomme,项目名称:nvda,代码行数:12,代码来源:__init__.py

示例15: beep_sequence

def beep_sequence(*sequence):
	"""	Play a simple synchronous monophonic beep sequence
	A beep sequence is an iterable containing one of two kinds of elements.
	An element consisting of a tuple of two items is interpreted as a frequency and duration. Note, this function plays beeps synchronously, unlike tones.beep
	A single integer is assumed to be a delay in ms.
	"""
	for element in sequence:
		if not isinstance(element, collections.Sequence):
			time.sleep(element / 1000)
		else:
			tone, duration = element
			time.sleep(duration / 1000)
			tones.beep(tone, duration)
开发者ID:cafeventos,项目名称:NVDARemote,代码行数:13,代码来源:beep_sequence.py


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