From 43a49ca570ef18b0c99d7f1d814e76079c7d827e Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 14 Apr 2016 22:09:23 +0300 Subject: [PATCH] notifications fix - busy status --- src/callbacks.py | 12 ++++++------ src/menu.py | 18 +++++++----------- src/styles/style.qss | 17 +++++++++-------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index d2aa47f..a6d139f 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -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' diff --git a/src/menu.py b/src/menu.py index ab45cb8..20174f6 100644 --- a/src/menu.py +++ b/src/menu.py @@ -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']) diff --git a/src/styles/style.qss b/src/styles/style.qss index 836f5de..5620bff 100644 --- a/src/styles/style.qss +++ b/src/styles/style.qss @@ -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; @@ -1267,4 +1259,13 @@ QPushButton:hover #toxygen { color: #A9A9A9; +} + +QCheckBox +{ + spacing: 5px; + outline: none; + color: #bbb; + margin-bottom: 2px; + text-align: center; } \ No newline at end of file