개정판 b959bc14
add opc relation coloring and post process
Change-Id: I59a57d93d424f19474db2b0056ea4ad59fb85807
DTI_PID/DTI_PID/OPCRelationDialog.py | ||
---|---|---|
82 | 82 |
self.ui.tableWidgetSource.setItem(row, 6, item) |
83 | 83 |
|
84 | 84 |
if opc['Index'] and len(opc['Index'].split(',')) != 1: |
85 |
item.setText('Error') |
|
85 |
item.setText('Error, Please Check From OPC in Draiwng') |
|
86 |
item.setBackground(Qt.red) |
|
86 | 87 |
self.error = True |
87 | 88 |
|
88 | 89 |
row += 1 |
... | ... | |
228 | 229 |
opcs = [opc for opc in self._opcs if line_no_item and opc['tag'] and line_no_item is not opc['tag'] \ |
229 | 230 |
and opc['Drawing'] != drawing and self.compare_line_no(line_no_item, opc['tag']) \ |
230 | 231 |
and opc['Index'] != symbol_connection_index] |
231 |
if not opcs: |
|
232 |
if not opcs or len(opcs) > 1:
|
|
232 | 233 |
item = self.ui.tableWidgetSource.item(row, 4) |
233 | 234 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 4, QTableWidgetItem('')) |
234 | 235 |
item = self.ui.tableWidgetSource.item(row, 5) |
235 | 236 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 5, QTableWidgetItem('')) |
236 | 237 |
item = self.ui.tableWidgetSource.item(row, 6) |
237 | 238 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 6, QTableWidgetItem('')) |
239 |
if len(opcs) > 1: |
|
240 |
if not hasattr(item, 'tag'): |
|
241 |
item.setBackground(Qt.yellow) |
|
238 | 242 |
elif len(opcs) == 1: |
239 | 243 |
item = QTableWidgetItem(opcs[0]['Drawing']) |
240 | 244 |
item.setFlags(Qt.ItemIsEnabled) |
... | ... | |
246 | 250 |
item.setFlags(Qt.ItemIsEnabled) |
247 | 251 |
self.ui.tableWidgetSource.setItem(row, 6, item) |
248 | 252 |
|
253 |
# check 1:N, N:1 error |
|
254 |
opc_counts = {} |
|
255 |
for row in range(self.ui.tableWidgetSource.rowCount()): |
|
256 |
item = self.ui.tableWidgetSource.item(row, 6) |
|
257 |
opc_uid = item.text() |
|
258 |
if not opc_uid: |
|
259 |
continue |
|
260 |
if opc_uid not in opc_counts: |
|
261 |
opc_counts[opc_uid] = [1, row] |
|
262 |
else: |
|
263 |
opc_counts[opc_uid][0] = opc_counts[opc_uid][0] + 1 |
|
264 |
opc_counts[opc_uid].append(row) |
|
265 |
|
|
266 |
for opc_uid, info in opc_counts.items(): |
|
267 |
if info[0] == 1: |
|
268 |
continue |
|
269 |
|
|
270 |
for row in info[1:]: |
|
271 |
item = self.ui.tableWidgetSource.item(row, 4) |
|
272 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 4, QTableWidgetItem('')) |
|
273 |
item = self.ui.tableWidgetSource.item(row, 5) |
|
274 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 5, QTableWidgetItem('')) |
|
275 |
item = self.ui.tableWidgetSource.item(row, 6) |
|
276 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 6, QTableWidgetItem('')) |
|
277 |
|
|
249 | 278 |
def on_target_item_double_clicked(self, item): |
250 | 279 |
""" assign target opc with double clicked item """ |
251 | 280 |
current = self.ui.tableWidgetSource.currentItem() |
내보내기 Unified diff