You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.0 KiB
Python
55 lines
2.0 KiB
Python
2 years ago
|
from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox
|
||
|
|
||
|
import sys
|
||
|
|
||
|
class DeviceDialog(QDialog):
|
||
|
def __init__(self, parent=None):
|
||
|
super().__init__(parent)
|
||
|
self.initUI()
|
||
|
|
||
|
def initUI(self):
|
||
|
layout = QFormLayout()
|
||
|
proType = QComboBox()
|
||
|
proType.addItems(['DP', 'PA'])
|
||
|
proType.setObjectName('ProtocolType')
|
||
|
masterSlaveModel = QComboBox()
|
||
|
masterSlaveModel.addItems(['主站', '从站'])
|
||
|
masterSlaveModel.setObjectName('masterSlaveModel')
|
||
|
|
||
|
deviceName = QLineEdit()
|
||
|
deviceName.setObjectName('deviceName')
|
||
|
|
||
|
pvUpperLimit = QLineEdit()
|
||
|
pvUpperLimit.setObjectName('pvUpperLimit')
|
||
|
|
||
|
pvLowerLimit = QLineEdit()
|
||
|
pvLowerLimit.setObjectName('pvLowerLimit')
|
||
|
|
||
|
pvUnit = QLineEdit()
|
||
|
pvUnit.setObjectName('pvUnit')
|
||
|
|
||
|
layout.addRow('协议类型', proType)
|
||
|
layout.addRow('主从模式', masterSlaveModel)
|
||
|
layout.addRow("设备名:", deviceName)
|
||
|
layout.addRow("量程上限:", pvUpperLimit)
|
||
|
layout.addRow("量程下限:", pvLowerLimit)
|
||
|
layout.addRow("单位:", pvUnit)
|
||
|
|
||
|
|
||
|
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||
|
button_box.accepted.connect(self.accept)
|
||
|
button_box.rejected.connect(self.reject)
|
||
|
|
||
|
layout.addRow(button_box)
|
||
|
|
||
|
self.setLayout(layout)
|
||
|
self.setWindowTitle("Input Parameters")
|
||
|
|
||
|
def getParameters(self):
|
||
|
proType = self.findChild(QComboBox, "ProtocolType").currentText()
|
||
|
masterSlaveModel = self.findChild(QComboBox, "masterSlaveModel").currentText()
|
||
|
deviceName = self.findChild(QLineEdit, "deviceName").text()
|
||
|
pvUpperLimit = self.findChild(QLineEdit, "pvUpperLimit").text()
|
||
|
pvLowerLimit = self.findChild(QLineEdit, "pvLowerLimit").text()
|
||
|
pvUnit = self.findChild(QLineEdit, "pvUnit").text()
|
||
|
return deviceName, proType, masterSlaveModel, pvUpperLimit, pvLowerLimit, pvUnit
|