From f1e5ae4b84cb81f87bed213320a4d0a4484b9ca5 Mon Sep 17 00:00:00 2001 From: DonRenando Date: Sat, 4 Apr 2015 23:56:10 +0200 Subject: [PATCH] walouf --- client/view/mainWindow.py | 3 +- client/view/mainWindow.ui | 8 +++- client/view/pm.py | 72 ++++++++++++++++++++++++++++ client/view/pm.ui | 99 +++++++++++++++++++++++++++++++++++++++ client/view/start.py | 36 +++++++++++++- 5 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 client/view/pm.py create mode 100644 client/view/pm.ui diff --git a/client/view/mainWindow.py b/client/view/mainWindow.py index 14ab3dd..ac2cae1 100755 --- a/client/view/mainWindow.py +++ b/client/view/mainWindow.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mainWindow.ui' # -# Created: Sat Apr 4 15:44:01 2015 +# Created: Sat Apr 4 23:06:45 2015 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! @@ -28,6 +28,7 @@ class Ui_Dialog(object): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.setEnabled(True) Dialog.resize(827, 558) + Dialog.setMaximumSize(QtCore.QSize(827, 558)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8("../../../../../../Images/Homer-Simpson-homer-simpson-3065329-800-600.jpg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Dialog.setWindowIcon(icon) diff --git a/client/view/mainWindow.ui b/client/view/mainWindow.ui index 35d42c3..c2bca1b 100755 --- a/client/view/mainWindow.ui +++ b/client/view/mainWindow.ui @@ -9,10 +9,16 @@ 0 0 - 827 + 813 558 + + + 827 + 558 + + Dialog diff --git a/client/view/pm.py b/client/view/pm.py new file mode 100644 index 0000000..bb7fe45 --- /dev/null +++ b/client/view/pm.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'pm.ui' +# +# Created: Sat Apr 4 23:20:13 2015 +# by: PyQt4 UI code generator 4.11.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName(_fromUtf8("Form")) + Form.resize(560, 339) + self.txtOutput = QtGui.QTextEdit(Form) + self.txtOutput.setGeometry(QtCore.QRect(20, 40, 531, 231)) + self.txtOutput.setMinimumSize(QtCore.QSize(200, 0)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Arial")) + font.setPointSize(14) + font.setItalic(False) + self.txtOutput.setFont(font) + self.txtOutput.setFocusPolicy(QtCore.Qt.NoFocus) + self.txtOutput.setAcceptDrops(False) + self.txtOutput.setFrameShape(QtGui.QFrame.NoFrame) + self.txtOutput.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.txtOutput.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) + self.txtOutput.setObjectName(_fromUtf8("txtOutput")) + self.horizontalLayoutWidget = QtGui.QWidget(Form) + self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 290, 431, 31)) + self.horizontalLayoutWidget.setObjectName(_fromUtf8("horizontalLayoutWidget")) + self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) + self.lineEdit = QtGui.QLineEdit(self.horizontalLayoutWidget) + self.lineEdit.setObjectName(_fromUtf8("lineEdit")) + self.horizontalLayout.addWidget(self.lineEdit) + self.pushButton = QtGui.QPushButton(self.horizontalLayoutWidget) + self.pushButton.setObjectName(_fromUtf8("pushButton")) + self.horizontalLayout.addWidget(self.pushButton) + self.pushButton_2 = QtGui.QPushButton(Form) + self.pushButton_2.setGeometry(QtCore.QRect(460, 290, 91, 27)) + self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(_translate("Form", "Form", None)) + self.txtOutput.setHtml(_translate("Form", "\n" +"\n" +"


", None)) + self.pushButton.setText(_translate("Form", "Send message", None)) + self.pushButton_2.setText(_translate("Form", "send", None)) + diff --git a/client/view/pm.ui b/client/view/pm.ui new file mode 100644 index 0000000..23d6b15 --- /dev/null +++ b/client/view/pm.ui @@ -0,0 +1,99 @@ + + + Form + + + + 0 + 0 + 560 + 339 + + + + Form + + + + + 20 + 40 + 531 + 231 + + + + + 200 + 0 + + + + + Arial + 14 + false + + + + Qt::NoFocus + + + false + + + QFrame::NoFrame + + + Qt::ScrollBarAsNeeded + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:14pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Inconsolata';"><br /></p></body></html> + + + Qt::TextBrowserInteraction + + + + + + 20 + 290 + 431 + 31 + + + + + + + + + + Send message + + + + + + + + + 460 + 290 + 91 + 27 + + + + send file + + + + + + diff --git a/client/view/start.py b/client/view/start.py index 3914c0c..30b4f6b 100755 --- a/client/view/start.py +++ b/client/view/start.py @@ -4,10 +4,14 @@ from PySide.QtCore import * from PySide.QtGui import * import time, threading, datetime, time, random,re from socket import * - +from pm import Ui_Form Host = "127.0.0.1" Port = 2222 +#def selectFile(): +# lineEdit.setText(QFileDialog.getOpenFileName()) + +#pushButton.clicked.connect(selectFile) class MySignal(QObject): @@ -46,6 +50,24 @@ class MyThread(QThread): self.s = s self.gui = gui +class privateMessage () : + def __init__(self,main): + + #self.queueMsg= [] + #self.thread = MyThread() + #self.thread.finished.connect(self.UpdateChat) + + self.main = main + self.g = QtGui.QWidget() + self.ui = Ui_Form() + self.ui.setupUi(self.g) + self.g.show() + + def selectFile(): + self.ui.lineEdit.setText(''.join(QFileDialog.getOpenFileName())) + + self.ui.pushButton_2.clicked.connect(selectFile) + class start(QtGui.QDialog): @@ -86,7 +108,7 @@ class start(QtGui.QDialog): def ShowMessageAsText(self, txt): if re.match("^ERR_", txt): - self.ShowMessageErreur("Erreur !") + self.ShowMessageErreur("Erreur ! : " + txt) self.message_buffer += '
'+ txt +' ' @@ -107,6 +129,16 @@ class start(QtGui.QDialog): + + if txt.split(" ")[0] == "SUCC_INVITED" : + self.ShowMessageOK("invitation requested") + + if txt.split(" ")[0] == "ASKING_FOR_PM" : + self.ShowMessageOK("private discution from "+ txt.split(" ")[1] ) + #ouvrir fenetre !!!! + self.admin = privateMessage(self) + + if txt.split(" ")[0] == "SUCCESSFUL_LOGOUT" : self.ShowMessageOK("Sucessful logout !")