add contact form, some updates

This commit is contained in:
ingvar1995 2016-02-19 18:04:53 +03:00
parent d8b06efd7c
commit 17a48df7e5
3 changed files with 80 additions and 8 deletions

View file

@ -109,10 +109,4 @@ class LoginScreen(QtGui.QWidget):
if __name__ == '__main__': if __name__ == '__main__':
app = QtGui.QApplication(sys.argv) pass
ls = LoginScreen()
win = QtGui.QMainWindow()
ls.setupUi(win)
win.show()
app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
app.exec_()

View file

@ -4,13 +4,21 @@ from mainscreen import MainWindow
from profile import Profile from profile import Profile
import sys import sys
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
from tox import Tox
class login(object): class login(object):
def __init__(self, arr): def __init__(self, arr):
self.arr = arr self.arr = arr
def login_screen_close(self, t, number=-1, default=False, name=None): 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) print str(t), str(number), str(default), str(name)
self.t = t self.t = t
self.num = number self.num = number
@ -22,6 +30,9 @@ class login(object):
def main(): def main():
"""
main function of app. loads loginscreen if needed and starts mainscreen
"""
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon('images/icon.png')) app.setWindowIcon(QtGui.QIcon('images/icon.png'))
settings = Settings() settings = Settings()
@ -53,11 +64,22 @@ def main():
# loading profile # loading profile
print str(path), str(name) print str(path), str(name)
data = Profile.open_profile(path, name) data = Profile.open_profile(path, name)
# TODO: start tox iterate and set callbacks
tox = Tox(data, settings)
ms = MainWindow() ms = MainWindow()
ms.show() ms.show()
app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
app.exec_() 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__': if __name__ == '__main__':

56
src/menu.py Normal file
View file

@ -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_()