toxygen/src/notifications.py

15 lines
500 B
Python
Raw Normal View History

2016-02-24 20:01:25 +00:00
from PySide import QtGui
2016-02-25 08:32:40 +00:00
from util import curr_directory
2016-02-24 18:38:36 +00:00
# TODO: add sound notifications
2016-02-26 20:14:22 +00:00
# TODO: make app icon active
2016-02-24 18:38:36 +00:00
def tray_notification(title, text):
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
2016-02-25 08:32:40 +00:00
tray = QtGui.QSystemTrayIcon(QtGui.QIcon(curr_directory() + '/images/icon.png'))
2016-02-24 18:38:36 +00:00
tray.setContextMenu(QtGui.QMenu())
tray.show()
2016-02-25 08:32:40 +00:00
if len(text) > 30:
2016-02-25 20:40:00 +00:00
text = text[:27] + '...'
2016-02-25 08:32:40 +00:00
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)