개정판 82bbc6bc
minor code arrange
Change-Id: Iffd4a4b410233c27e45a843f07700266fdc1e9d0
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
809 | 809 |
self.addMessage.emit(MessageType.Error, message) |
810 | 810 |
# up to here |
811 | 811 |
|
812 |
# create short line |
|
812 | 813 |
if lines: |
813 | 814 |
new_lines = [] |
814 | 815 |
try: |
816 |
''' |
|
815 | 817 |
conns = [] |
816 | 818 |
for sym in symbols: |
817 | 819 |
if sym.conn_type: |
... | ... | |
821 | 823 |
if item is None: |
822 | 824 |
conns.append(sym.connectors[index]) |
823 | 825 |
|
824 |
#new_lines.extend(Worker.make_short_lines_sts(conns, None))
|
|
826 |
new_lines.extend(Worker.make_short_lines_sts(conns, None)) |
|
825 | 827 |
|
826 | 828 |
conns = [] |
827 | 829 |
for sym in symbols: |
... | ... | |
832 | 834 |
if item is None and sym.connectors[index]: |
833 | 835 |
conns.append(sym.connectors[index]) |
834 | 836 |
|
835 |
#new_lines.extend(Worker.make_short_lines_stl(lines, conns, None))
|
|
837 |
new_lines.extend(Worker.make_short_lines_stl(lines, conns, None)) |
|
836 | 838 |
|
837 | 839 |
for line in new_lines: |
838 | 840 |
self.graphicsView.scene().addItem(line) |
839 | 841 |
for conn in line.connectors: |
840 | 842 |
conn.transfer.onPosChanged.connect(line.onConnectorPosChaned) |
843 |
''' |
|
841 | 844 |
except Exception as ex: |
842 | 845 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
843 | 846 |
f"{sys.exc_info()[-1].tb_lineno}" |
844 | 847 |
self.addMessage.emit(MessageType.Error, message) |
848 |
# up to here |
|
845 | 849 |
|
846 | 850 |
# connect line to symbol |
847 | 851 |
try: |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
453 | 453 |
import math |
454 | 454 |
|
455 | 455 |
try: |
456 |
vectors = [(self.end_point()[0] - self.start_point()[0], self.end_point()[1] - self.start_point()[1]), |
|
457 |
(rhs.end_point()[0] - rhs.start_point()[0], rhs.end_point()[1] - rhs.start_point()[1])] |
|
456 |
#vectors = [(self.end_point()[0] - self.start_point()[0], self.end_point()[1] - self.start_point()[1]),
|
|
457 |
# (rhs.end_point()[0] - rhs.start_point()[0], rhs.end_point()[1] - rhs.start_point()[1])]
|
|
458 | 458 |
angle = self.getAngle(rhs) |
459 | 459 |
if (angle == 0) or (angle == math.pi): return True |
460 | 460 |
except ZeroDivisionError: |
... | ... | |
503 | 503 |
rhs = [item.dir().x(), item.dir().y()] |
504 | 504 |
dot = sum([lhs[i] * rhs[i] for i in range(len(lhs))]) |
505 | 505 |
angle = math.degrees(math.acos(dot / length)) |
506 |
if (abs(angle) < 5) or (abs(angle - 180) < 5):
|
|
506 |
if (abs(angle) < 10) or (abs(angle - 180) < 10):
|
|
507 | 507 |
_center = item.center() |
508 | 508 |
dx = [start_pt[0] - _center[0], end_pt[0] - _center[0]] |
509 | 509 |
dy = [start_pt[1] - _center[1], end_pt[1] - _center[1]] |
내보내기 Unified diff