From 70fba78c7bffeb0e7c4e4c3c7914d8e50dde5166 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 20 Feb 2016 23:50:10 +0300 Subject: [PATCH] ui update --- src/main.py | 16 +++++--- src/menu.py | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 5 deletions(-) diff --git a/src/main.py b/src/main.py index 9eaf024..1fac50f 100644 --- a/src/main.py +++ b/src/main.py @@ -35,13 +35,17 @@ def status(a, b, c): print str(b) -def friend_status(*args): - print 'Friend connected! Friend number: ' + str(args[1]) +def friend_status(a, b, c, d, e): + print 'Friend connected! Friend number: ' + str(c) + + +def message(a, b, c, d, e, f): + print 'Message: ', str(d) def main(): """ - main function of app. loads loginscreen if needed and starts mainscreen + main function of app. loads loginscreen if needed and starts mainscreen """ app = QtGui.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon('images/icon.png')) @@ -80,9 +84,11 @@ def main(): # bootstrap for data in node_generator(): tox.bootstrap(*data) - # TODO: set callbacks + # TODO: set all callbacks + tox.callback_friend_message(message, 0) tox.callback_self_connection_status(status, 0) - tox.callback_friend_connection_status(friend_status, 0) + #tox.callback_friend_connection_status(friend_status, 0) + # starting thread for tox iterate mainloop = ToxIterateThread(tox) mainloop.start() diff --git a/src/menu.py b/src/menu.py index 09cdacf..28f2b4a 100644 --- a/src/menu.py +++ b/src/menu.py @@ -172,6 +172,109 @@ class NetworkSettings(QtGui.QWidget): self.label_2.setText(QtGui.QApplication.translate("Form", "Port:", None, QtGui.QApplication.UnicodeUTF8)) +class PrivacySettings(QtGui.QWidget): + """Privacy settings form: history, typing notifications""" + + def __init__(self): + super(PrivacySettings, self).__init__() + self.initUI() + + def initUI(self): + self.setObjectName("privacySettings") + self.resize(350, 200) + self.setMinimumSize(QtCore.QSize(350, 200)) + self.setMaximumSize(QtCore.QSize(350, 200)) + self.setBaseSize(QtCore.QSize(350, 200)) + self.saveHistory = QtGui.QCheckBox(self) + self.saveHistory.setGeometry(QtCore.QRect(40, 20, 291, 22)) + self.saveHistory.setObjectName("saveHistory") + self.fileautoaccept = QtGui.QCheckBox(self) + self.fileautoaccept.setGeometry(QtCore.QRect(40, 60, 271, 22)) + self.fileautoaccept.setObjectName("fileautoaccept") + self.typingNotifications = QtGui.QCheckBox(self) + self.typingNotifications.setGeometry(QtCore.QRect(40, 90, 350, 31)) + self.typingNotifications.setBaseSize(QtCore.QSize(350, 200)) + self.typingNotifications.setObjectName("typingNotifications") + + self.retranslateUi() + QtCore.QMetaObject.connectSlotsByName(self) + + def retranslateUi(self): + self.setWindowTitle(QtGui.QApplication.translate("privacySettings", "Privacy settings", None, QtGui.QApplication.UnicodeUTF8)) + self.saveHistory.setText(QtGui.QApplication.translate("privacySettings", "Save chat history", None, QtGui.QApplication.UnicodeUTF8)) + self.fileautoaccept.setText(QtGui.QApplication.translate("privacySettings", "Allow file autoaccept", None, QtGui.QApplication.UnicodeUTF8)) + self.typingNotifications.setText(QtGui.QApplication.translate("privacySettings", "Send typing notifications", None, QtGui.QApplication.UnicodeUTF8)) + + +class NotificationsSettings(QtGui.QWidget): + """Notifications settings form""" + + def __init__(self): + super(NotificationsSettings, self).__init__() + self.initUI() + + 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.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.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)) + + +class InterfaceSettings(QtGui.QWidget): + """Interface settings form""" + + def __init__(self): + super(InterfaceSettings, self).__init__() + self.initUI() + + def initUI(self): + self.setObjectName("interfaceForm") + self.resize(300, 300) + self.setMinimumSize(QtCore.QSize(300, 300)) + self.setMaximumSize(QtCore.QSize(300, 300)) + self.setBaseSize(QtCore.QSize(300, 300)) + self.label = QtGui.QLabel(self) + self.label.setGeometry(QtCore.QRect(30, 20, 91, 21)) + font = QtGui.QFont() + font.setPointSize(16) + font.setWeight(75) + font.setBold(True) + self.label.setFont(font) + self.label.setObjectName("label") + self.themeSelect = QtGui.QComboBox(self) + self.themeSelect.setGeometry(QtCore.QRect(30, 60, 161, 31)) + font = QtGui.QFont() + font.setPointSize(17) + self.themeSelect.setFont(font) + self.themeSelect.setObjectName("themeSelect") + + self.retranslateUi() + QtCore.QMetaObject.connectSlotsByName(self) + + def retranslateUi(self): + self.setWindowTitle(QtGui.QApplication.translate("interfaceForm", "Interface settings", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("interfaceForm", "Theme:", None, QtGui.QApplication.UnicodeUTF8)) + + if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv)