-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevicedialog.py
More file actions
58 lines (42 loc) · 1.85 KB
/
devicedialog.py
File metadata and controls
58 lines (42 loc) · 1.85 KB
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
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QGroupBox, QDialog, QVBoxLayout, QGridLayout, QLabel
class DeviceDialog(QDialog):
def __init__(self, model, id, type, subtype, channel, parent=None):
super().__init__(parent)
self.setWindowTitle('RTL Sensor Configuration')
self.left = 10
self.top = 10
self.width = 320
self.height = 100
self.model = QLabel(model)
self.id = QLabel(id)
self.type = QLabel(type)
self.subtype = QLabel(str(subtype))
self.channel = QLabel(channel)
self.setGeometry(self.left, self.top, self.width, self.height)
self.horizontalGroupBox = QGroupBox("Sensor")
layout = QGridLayout()
layout.setColumnStretch(0, 2)
layout.setColumnStretch(1, 2)
layout.setColumnStretch(2, 2)
layout.setColumnStretch(3, 2)
layout.setColumnStretch(4, 2)
layout.setColumnStretch(5, 1)
layout.addWidget(QLabel('Model'),0,0)
layout.addWidget(self.model,0,1)
layout.addWidget(QLabel('Id'),1,0)
layout.addWidget(self.id,1,1)
layout.addWidget(QLabel('Type'),2,0)
layout.addWidget(self.type,2,1)
layout.addWidget(QLabel('Subtype'),3,0)
layout.addWidget(self.subtype,3,1)
layout.addWidget(QLabel('Channel'),4,0)
layout.addWidget(self.channel,4,1)
pushButton = QPushButton('Select sensor')
pushButton.clicked.connect(lambda: parent.saveDevice(self.model.text(), self.id.text(), self.type.text(), self.subtype.text(), self.channel.text()))
layout.addWidget(pushButton, 5, 0)
self.horizontalGroupBox.setLayout(layout)
windowLayout = QHBoxLayout()
windowLayout.addWidget(self.horizontalGroupBox)
self.setLayout(windowLayout)
self.show()