menu updates
This commit is contained in:
parent
3147d8d14e
commit
5e951b3387
29
src/menu.py
29
src/menu.py
@ -1,4 +1,5 @@
|
|||||||
from PySide import QtCore, QtGui
|
from PySide import QtCore, QtGui
|
||||||
|
from settings import Settings
|
||||||
|
|
||||||
|
|
||||||
class AddContact(QtGui.QWidget):
|
class AddContact(QtGui.QWidget):
|
||||||
@ -233,21 +234,31 @@ class NotificationsSettings(QtGui.QWidget):
|
|||||||
self.enableNotifications = QtGui.QCheckBox(self)
|
self.enableNotifications = QtGui.QCheckBox(self)
|
||||||
self.enableNotifications.setGeometry(QtCore.QRect(30, 20, 241, 22))
|
self.enableNotifications.setGeometry(QtCore.QRect(30, 20, 241, 22))
|
||||||
self.enableNotifications.setObjectName("enableNotifications")
|
self.enableNotifications.setObjectName("enableNotifications")
|
||||||
self.checkBox_2 = QtGui.QCheckBox(self)
|
self.soundNotifications = QtGui.QCheckBox(self)
|
||||||
self.checkBox_2.setGeometry(QtCore.QRect(30, 100, 231, 22))
|
self.soundNotifications.setGeometry(QtCore.QRect(30, 100, 231, 22))
|
||||||
self.checkBox_2.setObjectName("checkBox_2")
|
self.soundNotifications.setObjectName("checkBox_2")
|
||||||
self.checkBox_3 = QtGui.QCheckBox(self)
|
self.callsSound = QtGui.QCheckBox(self)
|
||||||
self.checkBox_3.setGeometry(QtCore.QRect(30, 60, 231, 22))
|
self.callsSound.setGeometry(QtCore.QRect(30, 60, 231, 22))
|
||||||
self.checkBox_3.setObjectName("checkBox_3")
|
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()
|
self.retranslateUi()
|
||||||
QtCore.QMetaObject.connectSlotsByName(self)
|
QtCore.QMetaObject.connectSlotsByName(self)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.setWindowTitle(QtGui.QApplication.translate("notificationsForm", "Notification settings", None, QtGui.QApplication.UnicodeUTF8))
|
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.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.soundNotifications.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.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):
|
class InterfaceSettings(QtGui.QWidget):
|
||||||
|
@ -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_type = TOX_SAVEDATA_TYPE['TOX_SAVE']
|
||||||
tox_options.contents.savedata_data = c_char_p(data)
|
tox_options.contents.savedata_data = c_char_p(data)
|
||||||
tox_options.contents.savedata_length = len(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_type = TOX_SAVEDATA_TYPE['NONE']
|
||||||
tox_options.contents.savedata_data = None
|
tox_options.contents.savedata_data = None
|
||||||
tox_options.contents.savedata_length = 0
|
tox_options.contents.savedata_length = 0
|
||||||
|
@ -38,7 +38,8 @@ class Settings(dict, Singleton):
|
|||||||
'auto_accept_from_friends': [],
|
'auto_accept_from_friends': [],
|
||||||
'friends_aliases': [],
|
'friends_aliases': [],
|
||||||
'typing_notifications': True,
|
'typing_notifications': True,
|
||||||
'auto_profile': None
|
'auto_profile': None,
|
||||||
|
'calls_sound': True
|
||||||
}
|
}
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user