el pollio : le client est une turie !

This commit is contained in:
DonRenando 2015-03-31 11:52:01 +02:00
parent 29f9492d32
commit 7b6795f1ea
2 changed files with 64 additions and 22 deletions

View File

@ -27,8 +27,8 @@
<file leaf-file-name="start.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/start.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.49646643" vertical-offset="259" max-vertical-offset="1200">
<caret line="36" column="8" selection-start-line="36" selection-start-column="8" selection-end-line="36" selection-end-column="8" />
<state vertical-scroll-proportion="0.74747473" vertical-offset="771" max-vertical-offset="1515">
<caret line="81" column="34" selection-start-line="81" selection-start-column="34" selection-end-line="81" selection-end-column="34" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
@ -98,6 +98,7 @@
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="FullScreen" value="false" />
<property name="LayoutCode.rearrangeEntriesPython" value="false" />
</component>
<component name="RunManager">
<list size="0" />
@ -116,26 +117,26 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1366" height="738" extended-state="6" />
<editor active="false" />
<frame x="0" y="0" width="1366" height="738" extended-state="7" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24981412" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
@ -163,8 +164,28 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/start.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.49646643" vertical-offset="259" max-vertical-offset="1200">
<caret line="36" column="8" selection-start-line="36" selection-start-column="8" selection-end-line="36" selection-end-column="8" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1545">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/start.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1200">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/start.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.74747473" vertical-offset="771" max-vertical-offset="1515">
<caret line="81" column="34" selection-start-line="81" selection-start-column="34" selection-end-line="81" selection-end-column="34" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>

View File

@ -2,9 +2,14 @@ from mainWindow import Ui_Dialog
from PyQt4 import QtGui, QtCore
import datetime
import time
from socket import *
Host = "127.0.0.1"
Port = 2222
Addr = (Host, Port)
class start(QtGui.QDialog):
def __init__(self):
super(start, self).__init__()
self.createWidgets()
@ -13,7 +18,7 @@ class start(QtGui.QDialog):
return ('[%s] ' % str(datetime.datetime.fromtimestamp(int(time.time())).strftime('%H:%M')))
def ShowMessageAsText( self, txt ):
def ShowMessageAsText(self, txt):
self.message_buffer += '\n' + self.getTimeStamp() + txt
@ -47,26 +52,42 @@ class start(QtGui.QDialog):
self.ShowMessageAsText("super et toi ?")
self.ShowMessageAsText("Yo les poulets !")
self.connectActions()
#self.UpdateMainDisplay()
# self.UpdateMainDisplay()
self.ui.txtOutput.setText(self.message_buffer)
def connectActions(self):
self.ui.pushButton_2.clicked.connect(self.admin)
self.ui.pushButton_2.clicked.connect(self.connecter)
self.ui.pushButton_3.clicked.connect(self.deco)
self.ui.pushButton.clicked.connect(self.client)
def connecter(self):
self.s = socket(AF_INET, SOCK_STREAM)
self.s.connect(Addr)
def deco(self):
self.s.close()
def client(self):
cmd = self.ui.lineEdit.text()
if cmd.lower() == "quit":
exit(0)
try:
self.s.send(cmd.encode())
# data , addr = s.recvfrom(4096)
# print(data.decode())
except timeout:
print("Erreur : Timeout. Le serveur ne repond pas.")
#def client(self):
# self.hide()
# self.admin = mainUtilisateur(self)
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
myapp = start()
myapp.show()