|
|
@ -233,14 +233,14 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
def exchange_action(self):
|
|
|
|
def exchange_action(self):
|
|
|
|
# 切换工程按钮槽函数
|
|
|
|
# 切换工程按钮槽函数
|
|
|
|
sender = self.sender()
|
|
|
|
sender = self.sender()
|
|
|
|
projectNumber = Globals.getValue('projectNumber')
|
|
|
|
projectName = Globals.getValue('currentPro')
|
|
|
|
if projectNumber == sender.index[0]:
|
|
|
|
if projectName == str(self.parent().model.datas[sender.index[0]][1]):
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
'警告',
|
|
|
|
'警告',
|
|
|
|
"工程已打开",
|
|
|
|
"工程已打开",
|
|
|
|
QMessageBox.Yes)
|
|
|
|
QMessageBox.Yes)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
print(sender.index[0])
|
|
|
|
# print(sender.index[0])
|
|
|
|
if sender.index[0] in self.parent().model.editableList:
|
|
|
|
if sender.index[0] in self.parent().model.editableList:
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
'警告',
|
|
|
|
'警告',
|
|
|
@ -255,8 +255,6 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
|
|
|
|
|
|
|
|
if proType in ['0', '1', '2', '3']:
|
|
|
|
if proType in ['0', '1', '2', '3']:
|
|
|
|
Globals.getValue('varTable').model.initTable()
|
|
|
|
Globals.getValue('varTable').model.initTable()
|
|
|
|
# if lastproType in ['0', '1', '2', '3']:
|
|
|
|
|
|
|
|
# Globals.getValue('varTable').model.refreshComboBox()
|
|
|
|
|
|
|
|
elif proType in ['4']:
|
|
|
|
elif proType in ['4']:
|
|
|
|
Globals.getValue('HartTable').model.initTable()
|
|
|
|
Globals.getValue('HartTable').model.initTable()
|
|
|
|
elif proType in ['5']:
|
|
|
|
elif proType in ['5']:
|
|
|
@ -269,7 +267,6 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
Globals.getValue('HartSimulateTable').model.initTable()
|
|
|
|
Globals.getValue('HartSimulateTable').model.initTable()
|
|
|
|
Globals.getValue('userTable').model.initTable()
|
|
|
|
Globals.getValue('userTable').model.initTable()
|
|
|
|
Globals.getValue('HistoryWidget').exchangeProject()
|
|
|
|
Globals.getValue('HistoryWidget').exchangeProject()
|
|
|
|
Globals.setValue('projectNumber', sender.index[0])
|
|
|
|
|
|
|
|
self.parent().proxy.invalidate()
|
|
|
|
self.parent().proxy.invalidate()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -297,7 +294,7 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if sender.oldName:
|
|
|
|
if sender.oldName:
|
|
|
|
if ProjectManage.editProject(name = sender.oldName, Nname = name, des = des):
|
|
|
|
if ProjectManage.editProject(name = sender.oldName, Nname = name, des = des, proType = proType):
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
reply = QMessageBox.question(self.parent(),
|
|
|
|
'警告',
|
|
|
|
'警告',
|
|
|
|
"工程名相同",
|
|
|
|
"工程名相同",
|
|
|
@ -319,6 +316,7 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
proMes.append('')
|
|
|
|
proMes.append('')
|
|
|
|
model.insert_data(proMes, rowIndex)
|
|
|
|
model.insert_data(proMes, rowIndex)
|
|
|
|
model.remove_row(rowIndex + 1)
|
|
|
|
model.remove_row(rowIndex + 1)
|
|
|
|
|
|
|
|
self.parent().proxy.invalidate()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_action(self):
|
|
|
|
def delete_action(self):
|
|
|
@ -327,6 +325,8 @@ class ProjectButtonDelegate(QItemDelegate):
|
|
|
|
name = str(model.datas[sender.index[0]][1])
|
|
|
|
name = str(model.datas[sender.index[0]][1])
|
|
|
|
ProjectManage.deleteProject(name = name)
|
|
|
|
ProjectManage.deleteProject(name = name)
|
|
|
|
model.remove_row(sender.index[0])
|
|
|
|
model.remove_row(sender.index[0])
|
|
|
|
|
|
|
|
if name == Globals.getValue('currentPro'):
|
|
|
|
|
|
|
|
Globals.setValue('currentPro', None)
|
|
|
|
|
|
|
|
|
|
|
|
class ProTypeBoxDelegate(ProjectButtonDelegate):
|
|
|
|
class ProTypeBoxDelegate(ProjectButtonDelegate):
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
def __init__(self, parent=None):
|
|
|
@ -341,6 +341,7 @@ class ProTypeBoxDelegate(ProjectButtonDelegate):
|
|
|
|
cmBox = getattr(self, comboBox)
|
|
|
|
cmBox = getattr(self, comboBox)
|
|
|
|
|
|
|
|
|
|
|
|
item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式','HART', 'TCRTD', 'AO/DO/PI', 'FF', 'FF模拟', 'HART模拟']
|
|
|
|
item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式','HART', 'TCRTD', 'AO/DO/PI', 'FF', 'FF模拟', 'HART模拟']
|
|
|
|
|
|
|
|
# item = ['MODBUSTCP 主站模式', 'MODBUSTCP 从站模式', 'MODBUSRTU 主站模式', 'MODBUSRTU 从站模式']
|
|
|
|
cmBox.addItems(item)
|
|
|
|
cmBox.addItems(item)
|
|
|
|
cmBox.index = [index.row(), index.column()]
|
|
|
|
cmBox.index = [index.row(), index.column()]
|
|
|
|
if self.parent().model.datas[index.row()][index.column()] in range(10):
|
|
|
|
if self.parent().model.datas[index.row()][index.column()] in range(10):
|
|
|
|