개정판 b00e81bf
issue #000: fix auto connection
Change-Id: Ifc83cdb7560a110d22593d09a389b99d95f0f875
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
573 | 573 |
texts = [item for item in worker.scene.items() if issubclass(type(item), QEngineeringTextItem)] |
574 | 574 |
for symbol in symbols: |
575 | 575 |
try: |
576 |
if symbol.iType == 18 or symbol.iType == 31: # opc will be checked later |
|
577 |
continue |
|
576 | 578 |
symbol.connectAttribute(texts) |
577 | 579 |
except Exception as ex: |
578 | 580 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
644 | 646 |
type(text) is QEngineeringTagNoTextItem or type(text) is QEngineeringTextItem): |
645 | 647 |
targetText.append(text) |
646 | 648 |
|
649 |
# check opc |
|
650 |
for symbol in symbols: |
|
651 |
try: |
|
652 |
if symbol.iType == 18 or symbol.iType == 31: |
|
653 |
symbol.connectAttribute(texts) |
|
654 |
except Exception as ex: |
|
655 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
656 |
sys.exc_info()[-1].tb_lineno) |
|
657 |
worker.display_message.emit(message) |
|
658 |
|
|
647 | 659 |
worker.need_update_texts = [] |
648 | 660 |
targetText = sorted(targetText, key=lambda param: len(param.text()), reverse=True) |
649 | 661 |
for symbol in symbols + equip_packages: |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
669 | 669 |
item.transfer.onRemoved.emit(item) |
670 | 670 |
|
671 | 671 |
if lines: |
672 |
new_lines = [] |
|
672 | 673 |
try: |
673 | 674 |
conns = [] |
674 | 675 |
for sym in symbols: |
... | ... | |
679 | 680 |
if item is None: |
680 | 681 |
conns.append(sym.connectors[index]) |
681 | 682 |
|
682 |
Worker.make_short_lines_sts(conns, None)
|
|
683 |
new_lines.extend(Worker.make_short_lines_sts(conns, None))
|
|
683 | 684 |
|
684 | 685 |
conns = [] |
685 | 686 |
for sym in symbols: |
... | ... | |
690 | 691 |
if item is None and sym.connectors[index]: |
691 | 692 |
conns.append(sym.connectors[index]) |
692 | 693 |
|
693 |
Worker.make_short_lines_stl(lines, conns, None) |
|
694 |
new_lines.extend(Worker.make_short_lines_stl(lines, conns, None)) |
|
695 |
|
|
696 |
for line in new_lines: |
|
697 |
self.graphicsView.scene().addItem(line) |
|
698 |
for conn in line.connectors: |
|
699 |
conn.transfer.onPosChanged.connect(line.onConnectorPosChaned) |
|
694 | 700 |
except Exception as ex: |
695 | 701 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
696 | 702 |
f"{sys.exc_info()[-1].tb_lineno}" |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
1525 | 1525 |
min_dist = sys.maxsize |
1526 | 1526 |
|
1527 | 1527 |
for connector2 in connectors: |
1528 |
if connector2.connectedItem or connector1 is connector2: |
|
1528 |
if connector2.connectedItem or connector1 is connector2 or connector1.parentItem() is connector2.parentItem():
|
|
1529 | 1529 |
continue |
1530 | 1530 |
|
1531 | 1531 |
dx = connector1.center()[0] - connector2.center()[0] |
... | ... | |
1548 | 1548 |
app_doc_data.lines.extend(new_lines) |
1549 | 1549 |
app_doc_data.allItems.extend(new_lines) |
1550 | 1550 |
|
1551 |
return new_lines |
|
1552 |
|
|
1551 | 1553 |
except Exception as ex: |
1552 | 1554 |
if worker: |
1553 | 1555 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
1645 | 1647 |
app_doc_data.lines.extend(new_lines) |
1646 | 1648 |
app_doc_data.allItems.extend(new_lines) |
1647 | 1649 |
|
1650 |
return new_lines |
|
1651 |
|
|
1648 | 1652 |
except Exception as ex: |
1649 | 1653 |
if worker: |
1650 | 1654 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
내보내기 Unified diff