|
|
@ -137,7 +137,7 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
areaLayout.addWidget(areaLabel, 0, 0)
|
|
|
|
areaLayout.addWidget(areaLabel, 0, 0)
|
|
|
|
areaLayout.addWidget(areaLabel2, 0, 1)
|
|
|
|
areaLayout.addWidget(areaLabel2, 0, 1)
|
|
|
|
areaLayout.addItem(self.horizontalSpacer, 0, 4)
|
|
|
|
areaLayout.addItem(self.horizontalSpacer, 0, 4)
|
|
|
|
widgetLists.append([areaLabel2, areaLayout])
|
|
|
|
widgetLists.append([areaLabel2, areaLayout, areaLabel])
|
|
|
|
|
|
|
|
|
|
|
|
elif '主站' in deviceName and dataType == 'AO' or ('从站' in deviceName and dataType == 'AI'):
|
|
|
|
elif '主站' in deviceName and dataType == 'AO' or ('从站' in deviceName and dataType == 'AI'):
|
|
|
|
areaLineEdit = QLineEdit('0')
|
|
|
|
areaLineEdit = QLineEdit('0')
|
|
|
@ -148,7 +148,7 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
areaLayout.addWidget(editbtn, 0, 3)
|
|
|
|
areaLayout.addWidget(editbtn, 0, 3)
|
|
|
|
areaLayout.addItem(self.horizontalSpacer, 0, 4)
|
|
|
|
areaLayout.addItem(self.horizontalSpacer, 0, 4)
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn, areaLayout])
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn, areaLayout, areaLabel])
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -161,14 +161,14 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
|
areaLayout.addWidget(areaLabel, i // 2, i % 2)
|
|
|
|
areaLayout.addWidget(areaLabel, i // 2, i % 2)
|
|
|
|
areaLayout.addWidget(areaLabel2, i // 2, i % 2 + 1)
|
|
|
|
areaLayout.addWidget(areaLabel2, i // 2, i % 2 + 1)
|
|
|
|
widgetLists.append([areaLabel2, areaLayout])
|
|
|
|
widgetLists.append([areaLabel2, areaLayout, areaLabel])
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
areaLabel = QLabel(dataType + str(i + 1) + ": " + byteLineEdit + 'Byte')
|
|
|
|
areaLabel = QLabel(dataType + str(i + 1) + ": " + byteLineEdit + 'Byte')
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
|
areaLayout.addWidget(areaLabel, i // 2, i % 2 + 2)
|
|
|
|
areaLayout.addWidget(areaLabel, i // 2, i % 2 + 2)
|
|
|
|
areaLayout.addWidget(areaLabel2, i // 2, i % 2 + 3)
|
|
|
|
areaLayout.addWidget(areaLabel2, i // 2, i % 2 + 3)
|
|
|
|
widgetLists.append([areaLabel2, areaLayout])
|
|
|
|
widgetLists.append([areaLabel2, areaLayout, areaLabel])
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
if '主站' in deviceName and dataType == 'DO' or (
|
|
|
|
if '主站' in deviceName and dataType == 'DO' or (
|
|
|
|
'从站' in deviceName and dataType == 'DI'):
|
|
|
|
'从站' in deviceName and dataType == 'DI'):
|
|
|
@ -184,7 +184,7 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
areaLayout.addWidget(areaLineEdit, i // 2, i % 2 + 2)
|
|
|
|
areaLayout.addWidget(areaLineEdit, i // 2, i % 2 + 2)
|
|
|
|
areaLayout.addWidget(editbtn, i // 2, i % 2 + 3)
|
|
|
|
areaLayout.addWidget(editbtn, i // 2, i % 2 + 3)
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn])
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn, areaLabel])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
areaLabel = QLabel(dataType + str(i + 1) + ": " + byteLineEdit + 'Byte')
|
|
|
|
areaLabel = QLabel(dataType + str(i + 1) + ": " + byteLineEdit + 'Byte')
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
|
areaLabel2 = QLabel('0')
|
|
|
@ -197,7 +197,7 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
areaLayout.addWidget(editbtn, i // 2, i % 2 + 7)
|
|
|
|
areaLayout.addWidget(editbtn, i // 2, i % 2 + 7)
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
editbtn.clicked.connect(lambda checked, btn=editbtn: self.wirteValue(btn))
|
|
|
|
|
|
|
|
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn])
|
|
|
|
widgetLists.append([areaLabel2, areaLineEdit, editbtn, areaLabel])
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
self.widgetList.append(widgetLists)
|
|
|
|
areaLayout.addItem(self.verticalSpacer, int(byteLineEdit) * 8 ,0)
|
|
|
|
areaLayout.addItem(self.verticalSpacer, int(byteLineEdit) * 8 ,0)
|
|
|
|
|
|
|
|
|
|
|
@ -208,13 +208,16 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
|
|
|
|
|
|
|
|
del self.widgetList[index - 1]
|
|
|
|
del self.widgetList[index - 1]
|
|
|
|
if init:
|
|
|
|
if init:
|
|
|
|
|
|
|
|
# print(222)
|
|
|
|
|
|
|
|
# self.mainwindow.devicesManange.getDevice(deviceName).addArea(type = dataType, bytes = int(byteLineEdit), nums = 1)
|
|
|
|
|
|
|
|
# self.mainwindow.devicesManange.recalculateAddress()
|
|
|
|
return
|
|
|
|
return
|
|
|
|
DevicesManange.updataAreas(dataType, order, byteLineEdit, deviceName, index)
|
|
|
|
DevicesManange.updataAreas(dataType, order, byteLineEdit, deviceName, index)
|
|
|
|
self.mainwindow.devicesManange.getDevice(deviceName).editArea(index = index - 1, type = dataType, order = order, bytes = int(byteLineEdit))
|
|
|
|
self.mainwindow.devicesManange.getDevice(deviceName).editArea(index = index - 1, type = dataType, order = order, bytes = int(byteLineEdit))
|
|
|
|
self.mainwindow.devicesManange.recalculateAddress()
|
|
|
|
self.mainwindow.devicesManange.recalculateAddress()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
DevicesManange.addAreas(dataType, order, byteLineEdit, deviceName)
|
|
|
|
DevicesManange.addAreas(dataType, order, byteLineEdit, deviceName)
|
|
|
|
self.mainwindow.devicesManange.getDevice(deviceName).addArea(type = dataType, bytes = int(byteLineEdit), nums = 1)
|
|
|
|
self.mainwindow.devicesManange.getDevice(deviceName).addArea(type = dataType, bytes = int(byteLineEdit), order = order, nums = 1)
|
|
|
|
self.mainwindow.devicesManange.recalculateAddress()
|
|
|
|
self.mainwindow.devicesManange.recalculateAddress()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -229,7 +232,7 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
deviceName = self.areaTabWidget.parent().parent().parent().parent().parent().windowTitle()
|
|
|
|
deviceName = self.areaTabWidget.parent().parent().parent().parent().parent().windowTitle()
|
|
|
|
# index = self.areaTabWidget.currentIndex()
|
|
|
|
# index = self.areaTabWidget.currentIndex()
|
|
|
|
valueList = []
|
|
|
|
valueList = []
|
|
|
|
|
|
|
|
didoValueList = []
|
|
|
|
if len(self.widgetList) > 0:
|
|
|
|
if len(self.widgetList) > 0:
|
|
|
|
for widgetLists in self.widgetList:
|
|
|
|
for widgetLists in self.widgetList:
|
|
|
|
for widgetList in widgetLists:
|
|
|
|
for widgetList in widgetLists:
|
|
|
@ -237,7 +240,13 @@ class AreaTabWidget(QMainWindow):
|
|
|
|
widgetList[0].setText(widgetList[1].text())
|
|
|
|
widgetList[0].setText(widgetList[1].text())
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(widgetList[1], QLineEdit):
|
|
|
|
if isinstance(widgetList[1], QLineEdit):
|
|
|
|
valueList.append(float(widgetList[1].text()))
|
|
|
|
dataType = widgetList[-1].text()[0:2]
|
|
|
|
|
|
|
|
# if dataType in ['DI', "DO"]:
|
|
|
|
|
|
|
|
didoValueList.append(float(widgetList[1].text()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
valueList.append(didoValueList)
|
|
|
|
|
|
|
|
didoValueList = []
|
|
|
|
|
|
|
|
# print(valueList)
|
|
|
|
self.mainwindow.devicesManange.writeAreas(deviceName = deviceName, values = valueList)
|
|
|
|
self.mainwindow.devicesManange.writeAreas(deviceName = deviceName, values = valueList)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|