개정판 8c6ea5a3
issue #481: add validation check for symbol connection and line type
Change-Id: I7e0d1095ddc784b2d67cf2584a1d29478a54b82e
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
395 | 395 |
error.area = self.area |
396 | 396 |
error.name = 'Error' |
397 | 397 |
errors.append(error) |
398 |
|
|
399 |
# check line type |
|
400 |
if self.conn_type: |
|
401 |
for index in range(len(self.conn_type)): |
|
402 |
item = self.connectors[index].connectedItem |
|
403 |
if item and type(item) is QEngineeringLineItem: |
|
404 |
if ((self.conn_type[index] == 'Primary' or self.conn_type[index] == 'Secondary') and not item.is_piping()) or \ |
|
405 |
(not (self.conn_type[index] == 'Primary' or self.conn_type[index] == 'Secondary') and item.is_piping(True)): |
|
406 |
error = SymbolSvgItem.createItem('Error', None, dataPath) |
|
407 |
error.setPosition(self.connectors[index].center()) |
|
408 |
error.parent = self |
|
409 |
error.msg = self.tr('line type error') |
|
410 |
error.setToolTip(error.msg) |
|
411 |
error.area = self.area |
|
412 |
error.name = 'Error' |
|
413 |
errors.append(error) |
|
414 |
|
|
398 | 415 |
except Exception as ex: |
399 | 416 |
from App import App |
400 | 417 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
내보내기 Unified diff