개정판 bb55f734
fix opc relation
Change-Id: I89acdbe167dc6ece39971e72bb4a7b7c01cfb8a1
DTI_PID/DTI_PID/OPCRelationDialog.py | ||
---|---|---|
98 | 98 |
|
99 | 99 |
def check_opc_data(self): |
100 | 100 |
# check 1:N, N:1 error |
101 |
valid = True |
|
101 | 102 |
opc_counts = {} |
102 | 103 |
for row in range(self.ui.tableWidgetSource.rowCount()): |
103 | 104 |
item = self.ui.tableWidgetSource.item(row, 6) |
... | ... | |
114 | 115 |
if info[0] == 1: |
115 | 116 |
continue |
116 | 117 |
|
118 |
valid = False |
|
119 |
|
|
117 | 120 |
for row in info[1:]: |
118 |
item = self.ui.tableWidgetSource.item(row, 4) |
|
119 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 4, QTableWidgetItem('')) |
|
120 |
item = self.ui.tableWidgetSource.item(row, 5) |
|
121 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 5, QTableWidgetItem('')) |
|
121 |
#item = self.ui.tableWidgetSource.item(row, 4)
|
|
122 |
#item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 4, QTableWidgetItem(''))
|
|
123 |
#item = self.ui.tableWidgetSource.item(row, 5)
|
|
124 |
#item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 5, QTableWidgetItem(''))
|
|
122 | 125 |
item = self.ui.tableWidgetSource.item(row, 6) |
123 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 6, QTableWidgetItem('')) |
|
126 |
#item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 6, QTableWidgetItem('')) |
|
127 |
item.setBackground(Qt.red) |
|
128 |
|
|
129 |
return valid |
|
124 | 130 |
|
125 | 131 |
def parse_line_no_for_opc(self): |
126 | 132 |
# create line no item code from createTextItem |
... | ... | |
280 | 286 |
item.setFlags(Qt.ItemIsEnabled) |
281 | 287 |
self.ui.tableWidgetSource.setItem(row, 6, item) |
282 | 288 |
|
283 |
if not for_data_check:
|
|
289 |
if for_data_check: |
|
284 | 290 |
self.check_opc_data() |
285 | 291 |
|
286 | 292 |
def on_target_item_double_clicked(self, item): |
... | ... | |
316 | 322 |
if (e.key() == Qt.Key_Delete) and self.ui.tableWidgetSource.hasFocus(): |
317 | 323 |
current = self.ui.tableWidgetSource.currentItem() |
318 | 324 |
if current: |
319 |
self.ui.tableWidgetSource.item(current.row(), 3).setText('') |
|
320 | 325 |
self.ui.tableWidgetSource.item(current.row(), 4).setText('') |
321 | 326 |
self.ui.tableWidgetSource.item(current.row(), 5).setText('') |
327 |
self.ui.tableWidgetSource.item(current.row(), 6).setText('') |
|
322 | 328 |
|
323 | 329 |
except Exception as ex: |
324 | 330 |
from App import App |
... | ... | |
330 | 336 |
""" save sql information to database """ |
331 | 337 |
from AppDocData import AppDocData |
332 | 338 |
|
333 |
if self.error: |
|
339 |
if self.error or not self.check_opc_data():
|
|
334 | 340 |
QMessageBox.about(self, self.tr('Error'), self.tr('Please check OPC data.')) |
335 | 341 |
return |
336 | 342 |
|
내보내기 Unified diff