walouf
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -9,10 +9,16 @@
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>827</width>
 | 
			
		||||
    <width>813</width>
 | 
			
		||||
    <height>558</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="maximumSize">
 | 
			
		||||
   <size>
 | 
			
		||||
    <width>827</width>
 | 
			
		||||
    <height>558</height>
 | 
			
		||||
   </size>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										72
									
								
								client/view/pm.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								client/view/pm.py
									
									
									
									
									
										Normal file
									
								
							@@ -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", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
 | 
			
		||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
 | 
			
		||||
"p, li { white-space: pre-wrap; }\n"
 | 
			
		||||
"</style></head><body style=\" font-family:\'Arial\'; font-size:14pt; font-weight:400; font-style:normal;\">\n"
 | 
			
		||||
"<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>", None))
 | 
			
		||||
        self.pushButton.setText(_translate("Form", "Send message", None))
 | 
			
		||||
        self.pushButton_2.setText(_translate("Form", "send", None))
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										99
									
								
								client/view/pm.ui
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								client/view/pm.ui
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>Form</class>
 | 
			
		||||
 <widget class="QWidget" name="Form">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>560</width>
 | 
			
		||||
    <height>339</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <widget class="QTextEdit" name="txtOutput">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>20</x>
 | 
			
		||||
     <y>40</y>
 | 
			
		||||
     <width>531</width>
 | 
			
		||||
     <height>231</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="minimumSize">
 | 
			
		||||
    <size>
 | 
			
		||||
     <width>200</width>
 | 
			
		||||
     <height>0</height>
 | 
			
		||||
    </size>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="font">
 | 
			
		||||
    <font>
 | 
			
		||||
     <family>Arial</family>
 | 
			
		||||
     <pointsize>14</pointsize>
 | 
			
		||||
     <italic>false</italic>
 | 
			
		||||
    </font>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="focusPolicy">
 | 
			
		||||
    <enum>Qt::NoFocus</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="acceptDrops">
 | 
			
		||||
    <bool>false</bool>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="frameShape">
 | 
			
		||||
    <enum>QFrame::NoFrame</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="verticalScrollBarPolicy">
 | 
			
		||||
    <enum>Qt::ScrollBarAsNeeded</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="html">
 | 
			
		||||
    <string><!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></string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="textInteractionFlags">
 | 
			
		||||
    <set>Qt::TextBrowserInteraction</set>
 | 
			
		||||
   </property>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QWidget" name="horizontalLayoutWidget">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>20</x>
 | 
			
		||||
     <y>290</y>
 | 
			
		||||
     <width>431</width>
 | 
			
		||||
     <height>31</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
    <item>
 | 
			
		||||
     <widget class="QLineEdit" name="lineEdit"/>
 | 
			
		||||
    </item>
 | 
			
		||||
    <item>
 | 
			
		||||
     <widget class="QPushButton" name="pushButton">
 | 
			
		||||
      <property name="text">
 | 
			
		||||
       <string>Send message</string>
 | 
			
		||||
      </property>
 | 
			
		||||
     </widget>
 | 
			
		||||
    </item>
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QPushButton" name="pushButton_2">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>460</x>
 | 
			
		||||
     <y>290</y>
 | 
			
		||||
     <width>91</width>
 | 
			
		||||
     <height>27</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>send file</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </widget>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
@@ -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 += '<br> <span style="color : #E6E6E6"> '+  txt +' </span>'
 | 
			
		||||
        
 | 
			
		||||
@@ -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 !")
 | 
			
		||||
             
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user