From 17a48df7e511f014e44753e471eca61e04d254a5 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Fri, 19 Feb 2016 18:04:53 +0300 Subject: [PATCH] add contact form, some updates --- src/loginscreen.py | 8 +------ src/main.py | 24 +++++++++++++++++++- src/menu.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 src/menu.py diff --git a/src/loginscreen.py b/src/loginscreen.py index d20deb8..7fb860f 100644 --- a/src/loginscreen.py +++ b/src/loginscreen.py @@ -109,10 +109,4 @@ class LoginScreen(QtGui.QWidget): if __name__ == '__main__': - app = QtGui.QApplication(sys.argv) - ls = LoginScreen() - win = QtGui.QMainWindow() - ls.setupUi(win) - win.show() - app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) - app.exec_() + pass diff --git a/src/main.py b/src/main.py index 84128ad..80722bc 100644 --- a/src/main.py +++ b/src/main.py @@ -4,13 +4,21 @@ from mainscreen import MainWindow from profile import Profile import sys from PySide import QtCore, QtGui +from tox import Tox class login(object): + def __init__(self, arr): self.arr = arr def login_screen_close(self, t, number=-1, default=False, name=None): + """ Function which processes data from login screen + :param t: 0 - window was closed, 1 - new profile was created, 2 - profile loaded + :param number: num of choosen profile in list (-1 by default) + :param default: was or not choosen profile marked as default + :param name: name of new profile + """ print str(t), str(number), str(default), str(name) self.t = t self.num = number @@ -22,6 +30,9 @@ class login(object): def main(): + """ + main function of app. loads loginscreen if needed and starts mainscreen + """ app = QtGui.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon('images/icon.png')) settings = Settings() @@ -53,11 +64,22 @@ def main(): # loading profile print str(path), str(name) data = Profile.open_profile(path, name) + # TODO: start tox iterate and set callbacks + tox = Tox(data, settings) ms = MainWindow() ms.show() app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) app.exec_() - # TODO: open mainscreen + del tox + + +class ToxIterateThread(QtCore.QThread): + + def __init__(self): + QtCore.QThread.__init__(self) + + def run(self): + pass if __name__ == '__main__': diff --git a/src/menu.py b/src/menu.py new file mode 100644 index 0000000..e542c7e --- /dev/null +++ b/src/menu.py @@ -0,0 +1,56 @@ +from PySide import QtCore, QtGui + + +class AddContact(QtGui.QWidget): + """Add contact form """ + + def __init__(self): + super(AddContact, self).__init__() + self.initUI() + + def initUI(self): + self.setObjectName('AddContact') + self.resize(568, 306) + self.sendRequestButton = QtGui.QPushButton(self) + self.sendRequestButton.setGeometry(QtCore.QRect(50, 270, 471, 31)) + self.sendRequestButton.setMinimumSize(QtCore.QSize(0, 0)) + self.sendRequestButton.setBaseSize(QtCore.QSize(0, 0)) + self.sendRequestButton.setObjectName("sendRequestButton") + self.lineEdit = QtGui.QLineEdit(self) + self.lineEdit.setGeometry(QtCore.QRect(50, 40, 471, 27)) + self.lineEdit.setObjectName("lineEdit") + self.label = QtGui.QLabel(self) + self.label.setGeometry(QtCore.QRect(70, 10, 81, 21)) + font = QtGui.QFont() + font.setPointSize(16) + font.setWeight(75) + font.setBold(True) + self.label.setFont(font) + self.label.setObjectName("label") + self.textEdit = QtGui.QTextEdit(self) + self.textEdit.setGeometry(QtCore.QRect(50, 110, 471, 151)) + self.textEdit.setObjectName("textEdit") + self.label_2 = QtGui.QLabel(self) + self.label_2.setGeometry(QtCore.QRect(60, 70, 101, 31)) + font = QtGui.QFont() + font.setPointSize(16) + font.setWeight(75) + font.setBold(True) + self.label_2.setFont(font) + self.label_2.setObjectName("label_2") + self.retranslateUi() + QtCore.QMetaObject.connectSlotsByName(self) + + def retranslateUi(self): + self.setWindowTitle(QtGui.QApplication.translate('AddContact', "Add contact", None, QtGui.QApplication.UnicodeUTF8)) + self.sendRequestButton.setText(QtGui.QApplication.translate("Form", "Send request", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate('AddContact', "TOX ID:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate('AddContact', "Message:", None, QtGui.QApplication.UnicodeUTF8)) + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + ex = AddContact() + ex.show() + app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) + app.exec_()