From 58a93c5b1f645ae7e3069ae6cb2ef3f91bdb6093 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 13 Apr 2011 18:32:47 +0000 Subject: [PATCH] better beep for MacOSX --- lib/core/common.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index ed42b30d3..800aeb557 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1874,6 +1874,9 @@ def beep(): Reference: http://de3.aminet.net/dev/src/clr.py.txt """ + def _failsafe(): + dataToStdout('\a', True) + if sys.platform == 'linux2': for dev in ('/dev/audio', '/dev/oss', '/dev/dsp', '/dev/sound'): if os.path.exists(dev): @@ -1897,10 +1900,17 @@ def beep(): curses.endwin() return except: - dataToStdout('\a', True) + _failsafe() + + elif sys.platform == 'darwin': + try: + import Carbon.Snd + Carbon.Snd.SysBeep(1) + except: + _failsafe() else: - dataToStdout('\a', True) + _failsafe() def runningAsAdmin(): isAdmin = False