|
|
|
@ -58,7 +58,7 @@ class VarTableModel(QAbstractTableModel):
|
|
|
|
|
|
|
|
|
|
def initTable(self):
|
|
|
|
|
self.datas = []
|
|
|
|
|
|
|
|
|
|
self.editableList = []
|
|
|
|
|
self.table.parent.initIcon()
|
|
|
|
|
proType = Globals.getValue('currentProType')
|
|
|
|
|
|
|
|
|
@ -230,10 +230,17 @@ class ModBusTCPSlaveModel(VarTableModel):
|
|
|
|
|
|
|
|
|
|
class VarButtonDelegate(QItemDelegate):
|
|
|
|
|
"""该类用于向单元格中添加按钮 任务表格"""
|
|
|
|
|
trendWidgetDict = {}
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
|
super(VarButtonDelegate, self).__init__(parent)
|
|
|
|
|
|
|
|
|
|
def trendWidget(self, varName):
|
|
|
|
|
if varName not in self.trendWidgetDict:
|
|
|
|
|
trendWidget = ActualTrend(varName = varName)
|
|
|
|
|
self.trendWidgetDict[varName] = trendWidget
|
|
|
|
|
return self.trendWidgetDict[varName]
|
|
|
|
|
|
|
|
|
|
def paint(self, painter, option, index):
|
|
|
|
|
if not self.parent().indexWidget(index):
|
|
|
|
|
button1 = QPushButton(
|
|
|
|
@ -442,7 +449,7 @@ class VarButtonDelegate(QItemDelegate):
|
|
|
|
|
if model.table.parent._isPopenOpen:
|
|
|
|
|
sender = self.sender()
|
|
|
|
|
name = str(model.datas[sender.index[0]][3])
|
|
|
|
|
trend = ActualTrend(varName = name)
|
|
|
|
|
trend = self.trendWidget(varName = name)
|
|
|
|
|
trend.show()
|
|
|
|
|
|
|
|
|
|
class ModbusTypeBox(QItemDelegate):
|
|
|
|
@ -450,11 +457,15 @@ class ModbusTypeBox(QItemDelegate):
|
|
|
|
|
super(ModbusTypeBox, self).__init__(parent)
|
|
|
|
|
|
|
|
|
|
def paint(self, painter, option, index):
|
|
|
|
|
if index.column() == 5:
|
|
|
|
|
if index.column() == 5 and index.row() not in self.parent().model.editableList:
|
|
|
|
|
data = self.parent().model.datas[index.row()]
|
|
|
|
|
comBox = str('cb' + str(index.row()) + str(index.column()))
|
|
|
|
|
# try:
|
|
|
|
|
# comboBox = getattr(self, comBox)
|
|
|
|
|
# except:
|
|
|
|
|
setattr(self, comBox, QComboBox())
|
|
|
|
|
comboBox = getattr(self, comBox)
|
|
|
|
|
# comboBox = getattr(self, comBox)
|
|
|
|
|
|
|
|
|
|
item = ['Coil Status', 'Input Status', 'Input Register', 'Holding Register']
|
|
|
|
|
comboBox.addItems(item)
|
|
|
|
|