0803更新

main
zhangxuxutm 2 years ago
parent b448dade02
commit 5548e87cd7

@ -249,12 +249,14 @@ class ProjectButtonDelegate(QItemDelegate):
return
self.loginWidget = LoginWidget()
self.loginWidget.show()
lastproType = Globals.getValue('currentProType')
ProjectManage.switchProject(str(self.parent().model.datas[sender.index[0]][1]), str(self.parent().model.datas[sender.index[0]][4]))
proType = Globals.getValue('currentProType')
if proType in ['0', '1', '2', '3']:
Globals.getValue('varTable').model.initTable()
if lastproType in ['0', '1', '2', '3']:
Globals.getValue('varTable').model.refreshComboBox()
elif proType in ['4']:
Globals.getValue('HartTable').model.initTable()
elif proType in ['5']:

@ -194,6 +194,20 @@ class VarTableModel(QAbstractTableModel):
self.datas[sourceRow], self.datas[destinationChild] = self.datas[destinationChild], self.datas[sourceRow]
self.table.proxy.invalidate()
def refreshComboBox(self):
for i in range(len(self.datas)):
cbRow = str('cb' + str(i) + '5')
index = self.index(i, 5)
delegate = self.table.itemDelegate(index)
comboBox = getattr(delegate, cbRow)
if self.datas[i][5] in [0, 1]:
comboBox.setCurrentIndex(self.datas[i][5])
elif self.datas[i][5] in [3, 4]:
comboBox.setCurrentIndex(self.datas[i][5] - 1)
else:
comboBox.setCurrentIndex(-1)
class ModBusTCPSlaveModel(VarTableModel):
def __init__(self, header, data: list, table = None):
'''

Loading…
Cancel
Save