|
|
|
@ -77,6 +77,7 @@ class DynamicAddBlock(QHBoxLayout):
|
|
|
|
|
self.buttonlist = []
|
|
|
|
|
self.blockViewlist = []
|
|
|
|
|
self.tbtypeList = TbtypeList #存放转换块的各种类型
|
|
|
|
|
# print(self.tbtypeList)
|
|
|
|
|
self.tbList = ['PressureTranslationBlock', 'TemperatureTranslationBlock', 'LevelTranslationBlock', 'FlowTranslationBlock'] #存放四个转换块
|
|
|
|
|
self.enumList = [TBType.pressureTB, TBType.tempTB, TBType.levelTB, TBType.flowTB]
|
|
|
|
|
self.initUI()
|
|
|
|
@ -123,6 +124,7 @@ class DynamicAddBlock(QHBoxLayout):
|
|
|
|
|
|
|
|
|
|
tbwidget.setLayout(tblayout)
|
|
|
|
|
tbcombox = TbCombox()
|
|
|
|
|
# print(tbType)
|
|
|
|
|
match tbType:
|
|
|
|
|
case TBType.pressureTB:
|
|
|
|
|
tbcombox.setCurrentIndex(0)
|
|
|
|
@ -131,14 +133,15 @@ class DynamicAddBlock(QHBoxLayout):
|
|
|
|
|
tbcombox.setCurrentIndex(1)
|
|
|
|
|
tblockBtn = QPushButton(tbcombox.currentText() + str(i + 1))
|
|
|
|
|
case TBType.levelTB:
|
|
|
|
|
# print(2222)
|
|
|
|
|
tbcombox.setCurrentIndex(2)
|
|
|
|
|
tblockBtn = QPushButton(tbcombox.currentText() + str(i + 1))
|
|
|
|
|
case TBType.flowTB:
|
|
|
|
|
tbcombox.setCurrentIndex(3)
|
|
|
|
|
tblockBtn = QPushButton(tbcombox.currentText() + str(i + 1))
|
|
|
|
|
|
|
|
|
|
tbcombox.setCurrentIndex(0)
|
|
|
|
|
tblockBtn = QPushButton('压力转换块' + str(i + 1))
|
|
|
|
|
# tbcombox.setCurrentIndex(0)
|
|
|
|
|
# tblockBtn = QPushButton('压力转换块' + str(i + 1))
|
|
|
|
|
tblockBtn.setObjectName("tbparameBtn")
|
|
|
|
|
# tblockBtn.setFixedSize(130, 43)
|
|
|
|
|
tblockBtn.setCheckable(True)
|
|
|
|
@ -164,6 +167,7 @@ class DynamicAddBlock(QHBoxLayout):
|
|
|
|
|
self.parameStackWidget = QStackedWidget()
|
|
|
|
|
for view in self.blockViewlist:
|
|
|
|
|
self.parameStackWidget.addWidget(view)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def switchParameterWidget(self, buttonType):
|
|
|
|
|
for index , button in enumerate(self.buttonlist):
|
|
|
|
@ -173,10 +177,11 @@ class DynamicAddBlock(QHBoxLayout):
|
|
|
|
|
def switchTbtype(self, index, combox, button):
|
|
|
|
|
|
|
|
|
|
tbType = combox.itemText(index)
|
|
|
|
|
buttonNumber = button.text()[-1:]
|
|
|
|
|
buttonNumber = button.text()[-1]
|
|
|
|
|
button.setText(tbType + str(buttonNumber))
|
|
|
|
|
if button.isChecked():
|
|
|
|
|
stackIndex = (int(self.blocklist[0]) + int(self.blocklist[1]) + index) + (int(buttonNumber) - 1) * 4
|
|
|
|
|
stackIndex = (int(self.blocklist[0]) + int(self.blocklist[2]) + index) + (int(buttonNumber) - 1) * 4
|
|
|
|
|
|
|
|
|
|
self.parameStackWidget.setCurrentIndex(stackIndex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -274,10 +279,10 @@ class BlockParameterManageWidget(QWidget):
|
|
|
|
|
address = self.deviceAddressEdit.text()
|
|
|
|
|
# print(address)
|
|
|
|
|
if address:
|
|
|
|
|
pattern = re.compile(r'^(?:[1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-6])$')
|
|
|
|
|
pattern = re.compile(r'^(?:[1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-7])$')
|
|
|
|
|
match = pattern.match(address)
|
|
|
|
|
if not match:
|
|
|
|
|
QMessageBox.warning(self, '提示', '请输入2 - 126。')
|
|
|
|
|
QMessageBox.warning(self, '提示', '请输入2 - 127。')
|
|
|
|
|
return
|
|
|
|
|
if self.initUIstat:
|
|
|
|
|
try:
|
|
|
|
@ -315,6 +320,7 @@ class BlockParameterManageWidget(QWidget):
|
|
|
|
|
self.splitter = QSplitter()
|
|
|
|
|
blocklist = self.blockManage.getBlockNums()
|
|
|
|
|
TbtypeList = self.blockManage.TBTypeList
|
|
|
|
|
|
|
|
|
|
self.blockLayout = DynamicAddBlock(blocklist, TbtypeList)
|
|
|
|
|
self.settingLayout.addLayout(self.blockLayout, 7)
|
|
|
|
|
self.settingLayout.addWidget(self.splitter, 11)
|
|
|
|
|