better beep for MacOSX

This commit is contained in:
Miroslav Stampar 2011-04-13 18:32:47 +00:00
parent bf55b0b77a
commit 58a93c5b1f

View File

@ -1874,6 +1874,9 @@ def beep():
Reference: http://de3.aminet.net/dev/src/clr.py.txt Reference: http://de3.aminet.net/dev/src/clr.py.txt
""" """
def _failsafe():
dataToStdout('\a', True)
if sys.platform == 'linux2': if sys.platform == 'linux2':
for dev in ('/dev/audio', '/dev/oss', '/dev/dsp', '/dev/sound'): for dev in ('/dev/audio', '/dev/oss', '/dev/dsp', '/dev/sound'):
if os.path.exists(dev): if os.path.exists(dev):
@ -1897,10 +1900,17 @@ def beep():
curses.endwin() curses.endwin()
return return
except: except:
dataToStdout('\a', True) _failsafe()
elif sys.platform == 'darwin':
try:
import Carbon.Snd
Carbon.Snd.SysBeep(1)
except:
_failsafe()
else: else:
dataToStdout('\a', True) _failsafe()
def runningAsAdmin(): def runningAsAdmin():
isAdmin = False isAdmin = False