toxygen/src/notifications.py

14 lines
424 B
Python
Raw Normal View History

2016-02-24 20:01:25 +00:00
from PySide import QtGui
2016-02-24 18:38:36 +00:00
# TODO: add sound notifications
2016-02-24 20:01:25 +00:00
# TODO: add reaction om mouse move
2016-02-24 18:38:36 +00:00
def tray_notification(title, text):
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
tray = QtGui.QSystemTrayIcon()
tray.setContextMenu(QtGui.QMenu())
tray.show()
2016-02-24 20:01:25 +00:00
if len(text) > 50:
text = text[:50] + '...'
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 4000)