tray menu #2 + notifications for friend connection status
This commit is contained in:
parent
c3f3f8f24f
commit
cea5344e4b
3 changed files with 11 additions and 2 deletions
|
@ -62,6 +62,8 @@ def friend_status(tox, friend_num, new_status, user_data):
|
|||
print "Friend's #{} status changed! New status: {}".format(friend_num, new_status)
|
||||
profile = Profile.get_instance()
|
||||
friend = profile.get_friend_by_number(friend_num)
|
||||
if friend.status is None and Settings.get_instance()['sound_notifications']:
|
||||
sound_notification(SOUND_NOTIFICATION['FRIEND_CONNECTION_STATUS'])
|
||||
invoke_in_main_thread(friend.set_status, new_status)
|
||||
invoke_in_main_thread(profile.update_filtration)
|
||||
|
||||
|
@ -76,6 +78,8 @@ def friend_connection_status(tox, friend_num, new_status, user_data):
|
|||
if new_status == TOX_CONNECTION['NONE']:
|
||||
invoke_in_main_thread(friend.set_status, None)
|
||||
invoke_in_main_thread(profile.update_filtration)
|
||||
if Settings.get_instance()['sound_notifications']:
|
||||
sound_notification(SOUND_NOTIFICATION['FRIEND_CONNECTION_STATUS'])
|
||||
elif friend.status is None:
|
||||
invoke_in_main_thread(profile.send_avatar, friend_num)
|
||||
|
||||
|
|
|
@ -69,7 +69,12 @@ class Toxygen(object):
|
|||
m = QtGui.QMenu()
|
||||
show = m.addAction('Open Toxygen')
|
||||
exit = m.addAction('Exit')
|
||||
m.connect(show, QtCore.SIGNAL("triggered()"), lambda: self.ms.activateWindow())
|
||||
|
||||
def show_window():
|
||||
self.ms.setWindowState(self.ms.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
|
||||
self.ms.activateWindow()
|
||||
|
||||
m.connect(show, QtCore.SIGNAL("triggered()"), show_window)
|
||||
m.connect(exit, QtCore.SIGNAL("triggered()"), lambda: app.exit())
|
||||
self.tray.setContextMenu(m)
|
||||
self.tray.show()
|
||||
|
|
|
@ -25,7 +25,7 @@ def sound_notification(t):
|
|||
elif t == SOUND_NOTIFICATION['FILE_TRANSFER']:
|
||||
f = curr_directory() + '/sounds/file.wav'
|
||||
else:
|
||||
return
|
||||
f = curr_directory() + '/sounds/contact.wav'
|
||||
m = Phonon.MediaSource(f)
|
||||
player = Phonon.createPlayer(Phonon.MusicCategory, m)
|
||||
player.play()
|
||||
|
|
Loading…
Reference in a new issue