Sounds.py 492 B

1234567891011121314151617181920
  1. import subprocess
  2. import threading
  3. class SystemSounds:
  4. @staticmethod
  5. def play_sound(id):
  6. threading.Thread(target=SystemSounds.play_sound_blocking, args=(id,)).start()
  7. @staticmethod
  8. def play_sound_blocking(id):
  9. subprocess.call(['/usr/bin/canberra-gtk-play','--id',id])
  10. @staticmethod
  11. def window_attention():
  12. SystemSounds.play_sound("window-attention")
  13. @staticmethod
  14. def complete():
  15. SystemSounds.play_sound("complete")