notifications fix - busy status

This commit is contained in:
ingvar1995 2016-04-14 22:09:23 +03:00
parent 7d7efa6acd
commit 43a49ca570
3 changed files with 22 additions and 25 deletions

View File

@ -61,7 +61,7 @@ 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']:
if friend.status is None and Settings.get_instance()['sound_notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
sound_notification(SOUND_NOTIFICATION['FRIEND_CONNECTION_STATUS'])
invoke_in_main_thread(friend.set_status, new_status)
invoke_in_main_thread(profile.update_filtration)
@ -77,7 +77,7 @@ 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']:
if Settings.get_instance()['sound_notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
sound_notification(SOUND_NOTIFICATION['FRIEND_CONNECTION_STATUS'])
elif friend.status is None:
invoke_in_main_thread(profile.send_avatar, friend_num)
@ -118,9 +118,9 @@ def friend_message(window, tray):
invoke_in_main_thread(profile.new_message, friend_number, message_type, message)
if not window.isActiveWindow():
friend = profile.get_friend_by_number(friend_number)
if settings['notifications']:
if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
invoke_in_main_thread(tray_notification, friend.name, message.decode('utf8'), tray, window)
if settings['sound_notifications']:
if settings['sound_notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
sound_notification(SOUND_NOTIFICATION['MESSAGE'])
return wrapped
@ -155,9 +155,9 @@ def tox_file_recv(window, tray):
file_name)
if not window.isActiveWindow():
friend = profile.get_friend_by_number(friend_number)
if settings['notifications']:
if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
invoke_in_main_thread(tray_notification, 'File from ' + friend.name, file_name, tray, window)
if settings['sound_notifications']:
if settings['sound_notifications'] and profile.status != TOX_USER_STATUS['BUSY']:
sound_notification(SOUND_NOTIFICATION['FILE_TRANSFER'])
else: # AVATAR
print 'Avatar'

View File

@ -337,19 +337,15 @@ class NotificationsSettings(CenteredWidget):
def initUI(self):
self.setObjectName("notificationsForm")
self.resize(300, 200)
self.setMinimumSize(QtCore.QSize(300, 200))
self.setMaximumSize(QtCore.QSize(300, 200))
self.setBaseSize(QtCore.QSize(300, 200))
self.resize(350, 200)
self.setMinimumSize(QtCore.QSize(350, 200))
self.setMaximumSize(QtCore.QSize(350, 200))
self.enableNotifications = QtGui.QCheckBox(self)
self.enableNotifications.setGeometry(QtCore.QRect(30, 20, 241, 22))
self.enableNotifications.setObjectName("enableNotifications")
self.soundNotifications = QtGui.QCheckBox(self)
self.soundNotifications.setGeometry(QtCore.QRect(30, 100, 231, 22))
self.soundNotifications.setObjectName("sound_notifications")
self.enableNotifications.setGeometry(QtCore.QRect(10, 20, 270, 20))
self.callsSound = QtGui.QCheckBox(self)
self.callsSound.setGeometry(QtCore.QRect(30, 60, 231, 22))
self.callsSound.setObjectName("calls_sound")
self.callsSound.setGeometry(QtCore.QRect(10, 120, 270, 20))
self.soundNotifications = QtGui.QCheckBox(self)
self.soundNotifications.setGeometry(QtCore.QRect(10, 70, 270, 20))
s = Settings.get_instance()
self.enableNotifications.setChecked(s['notifications'])
self.soundNotifications.setChecked(s['sound_notifications'])

View File

@ -63,14 +63,6 @@ QProgressBar::chunk:horizontal {
background-color: qlineargradient(spread:reflect, x1:1, y1:0.545, x2:1, y2:0, stop:0 rgba(28, 66, 111, 255), stop:1 rgba(37, 87, 146, 255));
}
QCheckBox
{
spacing: 5px;
outline: none;
color: #bbb;
margin-bottom: 2px;
}
QCheckBox:disabled
{
color: #777777;
@ -1268,3 +1260,12 @@ QPushButton:hover
{
color: #A9A9A9;
}
QCheckBox
{
spacing: 5px;
outline: none;
color: #bbb;
margin-bottom: 2px;
text-align: center;
}