From 5e951b33873677c4c4aca73c87fce69ac50c425d Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 25 Feb 2016 14:22:15 +0300 Subject: [PATCH] menu updates --- src/menu.py | 29 ++++++++++++++++++++--------- src/profile.py | 2 +- src/settings.py | 3 ++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/menu.py b/src/menu.py index 641747a..474a201 100644 --- a/src/menu.py +++ b/src/menu.py @@ -1,4 +1,5 @@ from PySide import QtCore, QtGui +from settings import Settings class AddContact(QtGui.QWidget): @@ -233,21 +234,31 @@ class NotificationsSettings(QtGui.QWidget): self.enableNotifications = QtGui.QCheckBox(self) self.enableNotifications.setGeometry(QtCore.QRect(30, 20, 241, 22)) self.enableNotifications.setObjectName("enableNotifications") - self.checkBox_2 = QtGui.QCheckBox(self) - self.checkBox_2.setGeometry(QtCore.QRect(30, 100, 231, 22)) - self.checkBox_2.setObjectName("checkBox_2") - self.checkBox_3 = QtGui.QCheckBox(self) - self.checkBox_3.setGeometry(QtCore.QRect(30, 60, 231, 22)) - self.checkBox_3.setObjectName("checkBox_3") - + self.soundNotifications = QtGui.QCheckBox(self) + self.soundNotifications.setGeometry(QtCore.QRect(30, 100, 231, 22)) + self.soundNotifications.setObjectName("checkBox_2") + self.callsSound = QtGui.QCheckBox(self) + self.callsSound.setGeometry(QtCore.QRect(30, 60, 231, 22)) + self.callsSound.setObjectName("checkBox_3") + s = Settings() + self.enableNotifications.setChecked(s['notifications']) + self.soundNotifications.setChecked(s['sound_notifications']) + self.callsSound.setChecked(s['calls_sound']) self.retranslateUi() QtCore.QMetaObject.connectSlotsByName(self) def retranslateUi(self): self.setWindowTitle(QtGui.QApplication.translate("notificationsForm", "Notification settings", None, QtGui.QApplication.UnicodeUTF8)) self.enableNotifications.setText(QtGui.QApplication.translate("notificationsForm", "Enable notifications", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_2.setText(QtGui.QApplication.translate("notificationsForm", "Enable call\'s sound", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_3.setText(QtGui.QApplication.translate("notificationsForm", "Enable sound notifications", None, QtGui.QApplication.UnicodeUTF8)) + self.soundNotifications.setText(QtGui.QApplication.translate("notificationsForm", "Enable call\'s sound", None, QtGui.QApplication.UnicodeUTF8)) + self.callsSound.setText(QtGui.QApplication.translate("notificationsForm", "Enable sound notifications", None, QtGui.QApplication.UnicodeUTF8)) + + def closeEvent(self, *args, **kwargs): + settings = Settings() + settings['notifications'] = self.enableNotifications.isChecked() + settings['sound_notifications'] = self.soundNotifications.isChecked() + settings['calls_sound'] = self.callsSound.isChecked() + settings.save() class InterfaceSettings(QtGui.QWidget): diff --git a/src/profile.py b/src/profile.py index 3af4824..5480f89 100644 --- a/src/profile.py +++ b/src/profile.py @@ -59,7 +59,7 @@ def tox_factory(data=None, settings=None): tox_options.contents.savedata_type = TOX_SAVEDATA_TYPE['TOX_SAVE'] tox_options.contents.savedata_data = c_char_p(data) tox_options.contents.savedata_length = len(data) - else: # create new profile + else: # create new profile tox_options.contents.savedata_type = TOX_SAVEDATA_TYPE['NONE'] tox_options.contents.savedata_data = None tox_options.contents.savedata_length = 0 diff --git a/src/settings.py b/src/settings.py index 0e938be..9199df0 100644 --- a/src/settings.py +++ b/src/settings.py @@ -38,7 +38,8 @@ class Settings(dict, Singleton): 'auto_accept_from_friends': [], 'friends_aliases': [], 'typing_notifications': True, - 'auto_profile': None + 'auto_profile': None, + 'calls_sound': True } def save(self):