개정판 bded697f
ID | bded697fd79df973d35df22a3b10c0d89750a368 |
상위 | c47ad347 |
add space funct on line
Change-Id: I513b6ffd6389af8256b07a82d09a8d4c6623b8b2
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
744 | 744 |
break |
745 | 745 |
connectors[0].connect(svg) |
746 | 746 |
#connectors[0].highlight(False) |
747 |
elif not strict and len(items) == 1 and type(items[0]) is QEngineeringLineItem and items[0].length() > svg.size[0] and items[0].length() > svg.size[1]:
|
|
747 |
elif not strict and len(items) == 1 and type(items[0]) is QEngineeringLineItem and items[0].length() > min(svg.size[0], svg.size[1]) and items[0].length() > 50:
|
|
748 | 748 |
if move: |
749 | 749 |
svg.scene().removeItem(svg) |
750 | 750 |
svg.resetPosition() |
... | ... | |
796 | 796 |
savedConnectors.append(None) |
797 | 797 |
|
798 | 798 |
inLine = QEngineeringLineItem(vertices=[items[0].start_point(), connectors[0].center()]) |
799 |
inLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
800 |
inLine.lineType = items[0].lineType |
|
801 |
|
|
802 | 799 |
outLine = QEngineeringLineItem(vertices=[connectors[1].center(), items[0].end_point()]) |
803 |
outLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
804 |
outLine.lineType = items[0].lineType |
|
805 |
|
|
806 |
inLine.connectors[0].connect(items[0].connectors[0].connectedItem, items[0].connectors[0]._connected_at) |
|
807 |
inLine.connectors[1].connect(svg) |
|
808 |
connectors[0].connect(inLine) |
|
809 |
outLine.connectors[0].connect(svg) |
|
810 |
outLine.connectors[1].connect(items[0].connectors[1].connectedItem, items[0].connectors[1]._connected_at) |
|
811 |
connectors[1].connect(outLine) |
|
812 |
|
|
813 |
if savedConnectors[0]: |
|
814 |
savedConnectors[0].connect(inLine) |
|
815 |
if savedConnectors[1]: |
|
816 |
savedConnectors[1].connect(outLine) |
|
817 |
|
|
818 |
scene.addItem(inLine) |
|
819 |
scene.addItem(outLine) |
|
820 |
items[0].transfer.onRemoved.emit(items[0]) |
|
800 |
|
|
801 |
if inLine.length() > 20 and outLine.length() > 20: |
|
802 |
inLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
803 |
inLine.lineType = items[0].lineType |
|
804 |
|
|
805 |
outLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
806 |
outLine.lineType = items[0].lineType |
|
807 |
|
|
808 |
inLine.connectors[0].connect(items[0].connectors[0].connectedItem, items[0].connectors[0]._connected_at) |
|
809 |
inLine.connectors[1].connect(svg) |
|
810 |
connectors[0].connect(inLine) |
|
811 |
outLine.connectors[0].connect(svg) |
|
812 |
outLine.connectors[1].connect(items[0].connectors[1].connectedItem, items[0].connectors[1]._connected_at) |
|
813 |
connectors[1].connect(outLine) |
|
814 |
|
|
815 |
if savedConnectors[0]: |
|
816 |
savedConnectors[0].connect(inLine) |
|
817 |
if savedConnectors[1]: |
|
818 |
savedConnectors[1].connect(outLine) |
|
819 |
|
|
820 |
scene.addItem(inLine) |
|
821 |
scene.addItem(outLine) |
|
822 |
items[0].transfer.onRemoved.emit(items[0]) |
|
821 | 823 |
|
822 | 824 |
elif not strict and not move: |
823 | 825 |
svg.angle = angle if angle else 0.0 |
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
128 | 128 |
|
129 | 129 |
event.accept() |
130 | 130 |
return |
131 |
elif event.key() == Qt.Key_C and not (event.modifiers() & Qt.ControlModifier):
|
|
131 |
elif (event.key() == Qt.Key_C or event.key() == Qt.Key_Space) and not (event.modifiers() & Qt.ControlModifier):
|
|
132 | 132 |
lines = [item for item in self.selectedItems() if type(item) == QEngineeringLineItem] |
133 | 133 |
lineNos = [item for item in self.selectedItems() if type(item) == QEngineeringLineNoTextItem] |
134 | 134 |
if len(lineNos) == 1 and not lines: |
... | ... | |
136 | 136 |
if not lineNos: |
137 | 137 |
for item in lines: |
138 | 138 |
item.keyPressEvent(event) |
139 |
if event.key() == Qt.Key_Space: |
|
140 |
break |
|
139 | 141 |
event.accept() |
140 | 142 |
return |
141 | 143 |
elif event.key() == Qt.Key_A or event.key() == Qt.Key_G: |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
1479 | 1479 |
self.reverse(True) |
1480 | 1480 |
elif event.key() == Qt.Key_A: |
1481 | 1481 |
self.toggleFlowMark() |
1482 |
elif event.key() == Qt.Key_Space: |
|
1483 |
from App import App |
|
1484 |
|
|
1485 |
items = self.scene().selectedItems() |
|
1486 |
if len(items) == 1 and items[0] is self: |
|
1487 |
self.contextSplit(App.mainWnd().current_pos) |
|
1488 |
else: |
|
1489 |
self.contextIntersection() |
|
1482 | 1490 |
elif event.key() == Qt.Key_G: |
1483 | 1491 |
self.freeze_attriute() |
1484 | 1492 |
elif event.key() == Qt.Key_Up: # translate up/down/left/right symbol |
... | ... | |
2364 | 2372 |
from App import App |
2365 | 2373 |
|
2366 | 2374 |
_pos = [round(pos.x()), round(pos.y())] |
2375 |
|
|
2376 |
if self.distanceTo(_pos) > 20: |
|
2377 |
return |
|
2378 |
|
|
2367 | 2379 |
if abs(_pos[0] - self.start_point()[0]) > abs(_pos[1] - self.start_point()[1]): |
2368 | 2380 |
_pos[1] = self.start_point()[1] |
2369 | 2381 |
else: |
... | ... | |
2379 | 2391 |
savedConnectors.append(None) |
2380 | 2392 |
|
2381 | 2393 |
inLine = QEngineeringLineItem(vertices=[self.start_point(), _pos]) |
2394 |
outLine = QEngineeringLineItem(vertices=[_pos, self.end_point()]) |
|
2395 |
|
|
2396 |
if inLine.length() < 20 or outLine.length() < 20: |
|
2397 |
return |
|
2398 |
|
|
2382 | 2399 |
inLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
2383 | 2400 |
inLine.lineType = self.lineType |
2384 | 2401 |
|
2385 |
outLine = QEngineeringLineItem(vertices=[_pos, self.end_point()]) |
|
2386 | 2402 |
outLine.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
2387 | 2403 |
outLine.lineType = self.lineType |
2388 | 2404 |
|
내보내기 Unified diff