une turie, le retour !
This commit is contained in:
parent
270a10de1b
commit
4feefdd4aa
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'mainWindow.ui'
|
||||
#
|
||||
# Created: Fri Apr 3 14:33:44 2015
|
||||
# Created: Fri Apr 3 20:01:13 2015
|
||||
# by: PyQt4 UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -27,6 +27,9 @@ class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName(_fromUtf8("Dialog"))
|
||||
Dialog.resize(774, 540)
|
||||
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)
|
||||
self.verticalLayoutWidget = QtGui.QWidget(Dialog)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(600, 100, 160, 361))
|
||||
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
|
||||
@ -115,9 +118,6 @@ class Ui_Dialog(object):
|
||||
self.pushButton_5 = QtGui.QPushButton(self.horizontalLayoutWidget_3)
|
||||
self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
|
||||
self.horizontalLayout_3.addWidget(self.pushButton_5)
|
||||
self.pushButton_4 = QtGui.QPushButton(self.horizontalLayoutWidget_3)
|
||||
self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
|
||||
self.horizontalLayout_3.addWidget(self.pushButton_4)
|
||||
self.txtOutput = QtGui.QTextEdit(Dialog)
|
||||
self.txtOutput.setGeometry(QtCore.QRect(20, 160, 561, 291))
|
||||
self.txtOutput.setMinimumSize(QtCore.QSize(400, 0))
|
||||
@ -158,8 +158,7 @@ class Ui_Dialog(object):
|
||||
self.pushButton_6.setText(_translate("Dialog", "Change pseudo", None))
|
||||
self.pushButton_3.setText(_translate("Dialog", "Disconnect", None))
|
||||
self.pushButton_2.setText(_translate("Dialog", "Connect", None))
|
||||
self.pushButton_5.setText(_translate("Dialog", "Disable", None))
|
||||
self.pushButton_4.setText(_translate("Dialog", "Enable", None))
|
||||
self.pushButton_5.setText(_translate("Dialog", "Away From Keyboard", None))
|
||||
self.txtOutput.setHtml(_translate("Dialog", "<!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"
|
||||
|
@ -13,6 +13,10 @@
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>../../../../../../Images/Homer-Simpson-homer-simpson-3065329-800-600.jpg</normaloff>../../../../../../Images/Homer-Simpson-homer-simpson-3065329-800-600.jpg</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -206,14 +210,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="text">
|
||||
<string>Disable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
<string>Away From Keyboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2,7 +2,7 @@ from mainWindow import Ui_Dialog
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from PySide.QtCore import *
|
||||
from PySide.QtGui import *
|
||||
import time, threading, datetime, time, random
|
||||
import time, threading, datetime, time, random,re
|
||||
from socket import *
|
||||
|
||||
Host = "127.0.0.1"
|
||||
@ -81,14 +81,22 @@ class start(QtGui.QDialog):
|
||||
|
||||
def ShowMessageAsText(self, txt):
|
||||
|
||||
if re.match("^ERR_", txt):
|
||||
self.ShowMessageErreur("Erreur !")
|
||||
|
||||
self.message_buffer += '<br> <span style="color : #E6E6E6"> '+ txt.split(" ")[0] +' </span>'
|
||||
|
||||
|
||||
|
||||
if txt.split(" ")[0] == "SUCCESSFUL_LOGOUT" :
|
||||
self.ShowMessageOK("Sucessful logout !")
|
||||
|
||||
if txt.split(" ")[0] == "SUCC_DISABLED" :
|
||||
self.ShowMessageOK("You are AFK !")
|
||||
|
||||
if txt.split(" ")[0] == "SUCC_ENABLED" :
|
||||
self.ShowMessageOK("You are back !")
|
||||
|
||||
|
||||
if txt.split(" ")[0] == "SUCC_VALID_NICKNAME" :
|
||||
self.ShowMessageOK("Sucessful nickname change !")
|
||||
|
||||
@ -135,6 +143,38 @@ class start(QtGui.QDialog):
|
||||
self.ui.pushButton.clicked.connect(self.client)
|
||||
self.ui.pushButton_6.clicked.connect(self.changeN)
|
||||
|
||||
self.ui.pushButton_5.clicked.connect(self.away)
|
||||
|
||||
|
||||
def away(self):
|
||||
|
||||
if self.bouton == "disable" :
|
||||
cmdAway = "/disable "
|
||||
try:
|
||||
self.s.send(cmdAway.encode())
|
||||
self.ui.pushButton_5.setText("Back")
|
||||
|
||||
except timeout:
|
||||
self.ShowMessageErreur("Erreur : Timeout. Le serveur ne repond pas")
|
||||
self.ui.txtOutput.setText(self.message_buffer)
|
||||
sb = self.ui.txtOutput.verticalScrollBar()
|
||||
sb.setValue(sb.maximum())
|
||||
self.bouton = "enable"
|
||||
|
||||
elif self.bouton == "enable" :
|
||||
self.bouton = "disable"
|
||||
cmdAway = "/enable "
|
||||
try:
|
||||
self.s.send(cmdAway.encode())
|
||||
self.ui.pushButton_5.setText("Away From Keyboard")
|
||||
|
||||
except timeout:
|
||||
self.ShowMessageErreur("Erreur : Timeout. Le serveur ne repond pas")
|
||||
self.ui.txtOutput.setText(self.message_buffer)
|
||||
sb = self.ui.txtOutput.verticalScrollBar()
|
||||
sb.setValue(sb.maximum())
|
||||
|
||||
|
||||
def changeN(self):
|
||||
changePseudo = self.ui.lineEdit_2.text()
|
||||
cmdChange = "/name "+changePseudo
|
||||
@ -168,6 +208,8 @@ class start(QtGui.QDialog):
|
||||
self.ui.pushButton.setDisabled(False)
|
||||
self.ui.pushButton_2.setDisabled(True)
|
||||
self.ui.pushButton_3.setDisabled(False)
|
||||
self.ui.lineEdit_4.setDisabled(True)
|
||||
self.ui.lineEdit_3.setDisabled(True)
|
||||
self.thread.start()
|
||||
|
||||
|
||||
@ -198,6 +240,9 @@ class start(QtGui.QDialog):
|
||||
self.ui.pushButton_3.setDisabled(True)
|
||||
self.ui.pushButton_6.setDisabled(True)
|
||||
|
||||
self.ui.lineEdit_4.setDisabled(False)
|
||||
self.ui.lineEdit_3.setDisabled(False)
|
||||
|
||||
def ecoute(self):
|
||||
while 1 :
|
||||
data = self.s.recv(4096)
|
||||
@ -225,6 +270,7 @@ class start(QtGui.QDialog):
|
||||
self.ui.pushButton_3.setDisabled(True)
|
||||
self.ui.pushButton_6.setDisabled(True)
|
||||
self.message_buffer = ""
|
||||
self.bouton = "disable"
|
||||
|
||||
self.connectActions()
|
||||
|
||||
|
Reference in New Issue
Block a user