toxygen/src/notifications.py

15 lines
506 B
Python
Raw Normal View History

2016-02-24 23:01:25 +03:00
from PySide import QtGui
2016-02-25 11:32:40 +03:00
from util import curr_directory
2016-02-24 21:38:36 +03:00
# TODO: add sound notifications
2016-02-24 23:01:25 +03:00
# TODO: add reaction om mouse move
2016-02-24 21:38:36 +03:00
def tray_notification(title, text):
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
2016-02-25 11:32:40 +03:00
tray = QtGui.QSystemTrayIcon(QtGui.QIcon(curr_directory() + '/images/icon.png'))
2016-02-24 21:38:36 +03:00
tray.setContextMenu(QtGui.QMenu())
tray.show()
2016-02-25 11:32:40 +03:00
if len(text) > 30:
text = text[:30] + '...'
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)