missed contact.wav
This commit is contained in:
parent
cea5344e4b
commit
dd8f0e07e0
3 changed files with 14 additions and 3 deletions
|
@ -119,7 +119,7 @@ def friend_message(window, tray):
|
||||||
if not window.isActiveWindow():
|
if not window.isActiveWindow():
|
||||||
friend = profile.get_friend_by_number(friend_number)
|
friend = profile.get_friend_by_number(friend_number)
|
||||||
if settings['notifications']:
|
if settings['notifications']:
|
||||||
invoke_in_main_thread(tray_notification, friend.name, message.decode('utf8'), tray)
|
invoke_in_main_thread(tray_notification, friend.name, message.decode('utf8'), tray, window)
|
||||||
if settings['sound_notifications']:
|
if settings['sound_notifications']:
|
||||||
sound_notification(SOUND_NOTIFICATION['MESSAGE'])
|
sound_notification(SOUND_NOTIFICATION['MESSAGE'])
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PySide import QtGui
|
from PySide import QtGui, QtCore
|
||||||
from PySide.phonon import Phonon
|
from PySide.phonon import Phonon
|
||||||
from util import curr_directory
|
from util import curr_directory
|
||||||
# TODO: make app icon active
|
# TODO: make app icon active
|
||||||
|
@ -12,12 +12,23 @@ SOUND_NOTIFICATION = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def tray_notification(title, text, tray):
|
def tray_notification(title, text, tray, window):
|
||||||
|
"""
|
||||||
|
:param title: Name of user who sent message or file
|
||||||
|
:param text: text of message or file info
|
||||||
|
:param tray: ref to tray icon
|
||||||
|
:param window: main window
|
||||||
|
"""
|
||||||
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
|
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
|
||||||
if len(text) > 30:
|
if len(text) > 30:
|
||||||
text = text[:27] + '...'
|
text = text[:27] + '...'
|
||||||
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)
|
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)
|
||||||
|
|
||||||
|
def message_clicked():
|
||||||
|
window.setWindowState(window.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
|
||||||
|
window.activateWindow()
|
||||||
|
tray.connect(tray, QtCore.SIGNAL("messageClicked()"), message_clicked)
|
||||||
|
|
||||||
|
|
||||||
def sound_notification(t):
|
def sound_notification(t):
|
||||||
if t == SOUND_NOTIFICATION['MESSAGE']:
|
if t == SOUND_NOTIFICATION['MESSAGE']:
|
||||||
|
|
BIN
src/sounds/contact.wav
Normal file
BIN
src/sounds/contact.wav
Normal file
Binary file not shown.
Loading…
Reference in a new issue