-
Notifications
You must be signed in to change notification settings - Fork 0
/
receiver.py
64 lines (54 loc) · 2.22 KB
/
receiver.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
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from psrdada import *
from const import *
import psrdada
class MyApp(QWidget):
def __init__(self, parent=None):
super().__init__()
self.initUI(parent)
def initUI(self, par):
vbox = QVBoxLayout()
hbox1 = QHBoxLayout()
label1 = QLabel("CPU core:", self)
self.combo1 = QComboBox(self)
self.combo1.addItems(["1", "2"])
hbox1.addWidget(label1)
hbox1.addWidget(self.combo1)
vbox.addLayout(hbox1)
hbox2 = QHBoxLayout()
label2 = QLabel("network port:", self)
self.combo2 = QComboBox(self)
self.combo2.addItems(["1", "2"])
hbox2.addWidget(label2)
hbox2.addWidget(self.combo2)
vbox.addLayout(hbox2)
hbox3 = QHBoxLayout()
self.btnL = QPushButton("start", self)
self.btnL.clicked.connect(lambda: self.on_click(1))
self.btnR = QPushButton("finish", self)
self.btnR.clicked.connect(lambda: self.on_click(0))
hbox3.addWidget(self.btnL)
hbox3.addWidget(self.btnR)
vbox.addLayout(hbox3)
self.setLayout(vbox)
# 创建一个QProcess对象
self.process = QProcess(self)
self.process.setProcessChannelMode(QProcess.MergedChannels)
# self.process.errorOccurred.connect(self.handle_error)
self.process.started.connect(on_process_started)
# 连接其输出信号到update_text方法
self.process.readyReadStandardOutput.connect(
lambda: update_text(self, par.textEdit1)
)
def on_click(self, flag):
# print(DEFULT_KEY)
# global KEY
if flag == 1:
self.process.start(
"bash /home/idolsinger/mox/2-FAST_CODE/udpdadav2/run.sh"
# f"sudo /home/idolsinger/mox/2-FAST_CODE/udpdadav2/build/udpdadav2 -c {self.combo1.currentText()} --socket-mem 128 --proc-type auto --file-prefix pg1 -- -p {self.combo2.currentText()} -k {psrdada.KEY}"
# "sudo ./home/idolsinger/mox/2-FAST_CODE/udpdadav2/build/udpdadav2 -c 1 --socket-mem 128 --proc-type auto --file-prefix pg1 -w 84:00.1 -- -p 1 -k dada -T 524288"
)
else:
self.process.kill()