2017-09-11 16:44:17 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-09-23 12:38:56 +02:00
|
|
|
"""
|
2019-12-21 08:15:52 +01:00
|
|
|
Sound theme plugin using pycanberra
|
2019-09-23 12:38:56 +02:00
|
|
|
"""
|
2017-09-11 16:44:17 +02:00
|
|
|
|
|
|
|
from pybitmessage.bitmessageqt import sound
|
|
|
|
|
|
|
|
import pycanberra
|
|
|
|
|
|
|
|
_canberra = pycanberra.Canberra()
|
|
|
|
|
|
|
|
_theme = {
|
|
|
|
sound.SOUND_UNKNOWN: 'message-new-email',
|
|
|
|
sound.SOUND_CONNECTED: 'network-connectivity-established',
|
|
|
|
sound.SOUND_DISCONNECTED: 'network-connectivity-lost',
|
|
|
|
sound.SOUND_CONNECTION_GREEN: 'network-connectivity-established'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-21 08:15:52 +01:00
|
|
|
def connect_plugin(category, label=None): # pylint: disable=unused-argument
|
2019-09-23 12:38:56 +02:00
|
|
|
"""This function implements the entry point."""
|
2017-09-11 16:44:17 +02:00
|
|
|
try:
|
|
|
|
_canberra.play(0, pycanberra.CA_PROP_EVENT_ID, _theme[category], None)
|
|
|
|
except (KeyError, pycanberra.CanberraException):
|
|
|
|
pass
|