-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfake_tcps.py
87 lines (67 loc) · 2.78 KB
/
fake_tcps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import sys
from networking.client import PyClient
from PyQt5.QtWidgets import QApplication,QMainWindow,QLabel,QVBoxLayout,QWidget
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Fake TCP clients")
self.setFixedWidth(400)
self.setFixedHeight(800)
self.layout = QVBoxLayout()
widget = QWidget()
widget.setLayout(self.layout)
self.setCentralWidget(widget)
self.dextertext = QLabel()
self.dextertext.setWordWrap(True)
self.layout.addWidget(self.dextertext)
self.awg1text = QLabel()
self.awg1text.setWordWrap(True)
self.layout.addWidget(self.awg1text)
self.awg2text = QLabel()
self.awg2text.setWordWrap(True)
self.layout.addWidget(self.awg2text)
self.awg3text = QLabel()
self.awg3text.setWordWrap(True)
self.layout.addWidget(self.awg3text)
self.mwtext = QLabel()
self.mwtext.setWordWrap(True)
self.layout.addWidget(self.mwtext)
self.dextertcp = PyClient(port=8620,name='DExTer',pause=1)
self.dextertcp.start()
self.dextertcp.textin.connect(self.display_dexter_msg)
self.awg1tcp = PyClient(port=8623,name='AWG1',pause=1)
self.awg1tcp.start()
self.awg1tcp.textin.connect(self.display_awg1_msg)
self.awg2tcp = PyClient(port=8628,name='AWG2',pause=1)
self.awg2tcp.start()
self.awg2tcp.textin.connect(self.display_awg2_msg)
self.awg3tcp = PyClient(port=8637,name='AWG3',pause=1)
self.awg3tcp.start()
self.awg3tcp.textin.connect(self.display_awg3_msg)
# self.mwtcp = PyClient(port=8631,name='MW',pause=1)
# self.mwtcp.start()
# self.mwtcp.textin.connect(self.display_mw_msg)
self.display_dexter_msg()
self.display_awg1_msg()
self.display_awg2_msg()
self.display_mw_msg()
def display_dexter_msg(self,msg=''):
msg = msg.split('00000000000')[0]
self.dextertext.setText('Last Dexter TCP message received: '+msg)
def display_awg1_msg(self,msg=''):
msg = msg.split('00000000000')[0]
self.awg1text.setText('Last AWG1 TCP message received: '+msg)
def display_awg2_msg(self,msg=''):
msg = msg.split('00000000000')[0]
self.awg2text.setText('Last AWG2 TCP message received: '+msg)
def display_awg3_msg(self,msg=''):
msg = msg.split('00000000000')[0]
self.awg3text.setText('Last AWG3 TCP message received: '+msg)
def display_mw_msg(self,msg=''):
msg = msg.split('00000000000')[0]
self.mwtext.setText('Last MW TCP message received: '+msg)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()