개정판 e2ae85c2
issue #480: fixed an error to fail to detect line when symbol is flipped
- Ctrl + Arrow Key : 심볼 이동 빠르게
Change-Id: Ie4125ccb782c93f294d0b3cb9c0437f64f553412
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
397 | 397 |
return errors |
398 | 398 |
|
399 | 399 |
def includes(self, pt, margin=0): |
400 |
""" |
|
401 |
return True if symbol contains given point else return False |
|
402 |
""" |
|
400 |
"""return True if symbol contains given point else return False""" |
|
403 | 401 |
rect = self.sceneBoundingRect() |
404 | 402 |
allowed_error = 0.1 |
405 | 403 |
|
... | ... | |
621 | 619 |
x = float(tokens[0]) |
622 | 620 |
y = float(tokens[1]) |
623 | 621 |
elif len(tokens) >= 3: |
624 |
direction = tokens[0]
|
|
622 |
direction = connPts[index][0]
|
|
625 | 623 |
x = float(tokens[1]) |
626 | 624 |
y = float(tokens[2]) |
627 | 625 |
if len(tokens) >= 4: |
... | ... | |
641 | 639 |
self.connectors[index].symbol_idx = symbol_idx |
642 | 640 |
self.connectors[index].setPos((x, y)) |
643 | 641 |
self.connectors[index].connectPoint = (x, y) |
644 |
self.connectors[index].sceneConnectPoint = (connPts[index][0], connPts[index][1]) if len(
|
|
645 |
connPts[index]) == 2 else \
|
|
646 |
(connPts[index][1], connPts[index][2]) if len(connPts[index]) == 3 else \
|
|
647 |
(connPts[index][1], connPts[index][2]) if len(connPts[index]) == 4 else None
|
|
642 |
self.connectors[index].sceneConnectPoint = (connPts[index][0], connPts[index][1]) if \
|
|
643 |
len(connPts[index]) == 2 else (connPts[index][1], connPts[index][2]) if \
|
|
644 |
len(connPts[index]) == 3 else (connPts[index][1], connPts[index][2]) if \
|
|
645 |
len(connPts[index]) == 4 else None |
|
648 | 646 |
self.parentSymbol = parentSymbol |
649 | 647 |
self.childSymbol = childSymbol |
650 | 648 |
self.hasInstrumentLabel = hasInstrumentLabel |
... | ... | |
1014 | 1012 |
self.rotateSymbol() |
1015 | 1013 |
elif event.key() == Qt.Key_O and type(self) is not QEngineeringErrorItem: |
1016 | 1014 |
pass |
1017 |
#self.changeStandardPoint() |
|
1018 | 1015 |
elif event.key() == Qt.Key_C and type(self) is not QEngineeringErrorItem: |
1019 | 1016 |
self.changeConnPoint() |
1020 | 1017 |
elif event.key() == Qt.Key_F and type(self) is not QEngineeringErrorItem: |
1021 | 1018 |
self.flipSymbol() |
1022 |
elif event.key() == Qt.Key_X:
|
|
1019 |
elif event.key() == Qt.Key_Return:
|
|
1023 | 1020 |
dialog = QRotateSymbolDialog(None, self.angle, self.origin, self.zValue()) |
1024 | 1021 |
(isAccept, angle, x, y, z) = dialog.showDialog() |
1025 | 1022 |
|
... | ... | |
1027 | 1024 |
self.angle = angle |
1028 | 1025 |
self.loc = [x - self.symbolOrigin[0], y - self.symbolOrigin[1]] |
1029 | 1026 |
self.origin = [x, y] |
1030 |
# scene = self.scene() |
|
1031 |
# scene.removeItem(self) |
|
1032 |
# self.addSvgItemToScene(scene) |
|
1033 | 1027 |
self.rotate(self.getCurrentPoint(), self.angle) |
1034 | 1028 |
self.setZValue(z) |
1035 | 1029 |
elif event.key() == Qt.Key_Escape: |
... | ... | |
1043 | 1037 |
self.setTransform(transform) |
1044 | 1038 |
|
1045 | 1039 |
del self._rotating |
1046 |
elif event.key() == Qt.Key_Up: ### translate up/down/left/right symbol |
|
1047 |
self.loc[1] = self.loc[1] - 1 |
|
1048 |
self.origin[1] = self.origin[1] - 1 |
|
1040 |
elif event.key() == Qt.Key_Up: # translate up/down/left/right symbol |
|
1041 |
modifiers = QApplication.keyboardModifiers() |
|
1042 |
delta = 5 if modifiers == Qt.ControlModifier else 1 |
|
1043 |
|
|
1044 |
self.loc[1] = self.loc[1] - delta |
|
1045 |
self.origin[1] = self.origin[1] - delta |
|
1049 | 1046 |
self.rotate(self.getCurrentPoint(), self.angle) |
1050 | 1047 |
elif event.key() == Qt.Key_Down: |
1051 |
self.loc[1] = self.loc[1] + 1 |
|
1052 |
self.origin[1] = self.origin[1] + 1 |
|
1048 |
modifiers = QApplication.keyboardModifiers() |
|
1049 |
delta = 5 if modifiers == Qt.ControlModifier else 1 |
|
1050 |
|
|
1051 |
self.loc[1] = self.loc[1] + delta |
|
1052 |
self.origin[1] = self.origin[1] + delta |
|
1053 | 1053 |
self.rotate(self.getCurrentPoint(), self.angle) |
1054 | 1054 |
elif event.key() == Qt.Key_Left: |
1055 |
self.loc[0] = self.loc[0] - 1 |
|
1056 |
self.origin[0] = self.origin[0] - 1 |
|
1055 |
modifiers = QApplication.keyboardModifiers() |
|
1056 |
delta = 5 if modifiers == Qt.ControlModifier else 1 |
|
1057 |
|
|
1058 |
self.loc[0] = self.loc[0] - delta |
|
1059 |
self.origin[0] = self.origin[0] - delta |
|
1057 | 1060 |
self.rotate(self.getCurrentPoint(), self.angle) |
1058 | 1061 |
elif event.key() == Qt.Key_Right: |
1059 |
self.loc[0] = self.loc[0] + 1 |
|
1060 |
self.origin[0] = self.origin[0] + 1 |
|
1062 |
modifiers = QApplication.keyboardModifiers() |
|
1063 |
delta = 5 if modifiers == Qt.ControlModifier else 1 |
|
1064 |
|
|
1065 |
self.loc[0] = self.loc[0] + delta |
|
1066 |
self.origin[0] = self.origin[0] + delta |
|
1061 | 1067 |
self.rotate(self.getCurrentPoint(), self.angle) |
1062 |
elif event.key() == Qt.Key_I: |
|
1068 |
elif event.key() == Qt.Key_I or event.key() == Qt.Key_X:
|
|
1063 | 1069 |
from App import App |
1064 | 1070 |
App.mainWnd().keyPressEvent(event) |
1065 | 1071 |
|
... | ... | |
1383 | 1389 |
if component['ConnectionPoint']: |
1384 | 1390 |
for conn_pt in component['ConnectionPoint'].split('/'): |
1385 | 1391 |
tokens = conn_pt.split(',') |
1386 |
connPts.append(('AUTO', float(tokens[0]), float(tokens[1]), '0') if len(tokens) == 2 else \
|
|
1387 |
(tokens[0], float(tokens[1]), float(tokens[2]), '0') if len(tokens) == 3 else \
|
|
1388 |
(tokens[0], float(tokens[1]), float(tokens[2]), tokens[3]))
|
|
1392 |
connPts.append(('AUTO', float(tokens[0]), float(tokens[1]), '0') if len(tokens) == 2 else |
|
1393 |
(tokens[0], float(tokens[1]), float(tokens[2]), '0') if len(tokens) == 3 else
|
|
1394 |
(tokens[0], float(tokens[1]), float(tokens[2]), tokens[3])) |
|
1389 | 1395 |
|
1390 | 1396 |
baseSymbol = dbData.baseSymbol |
1391 | 1397 |
|
... | ... | |
1394 | 1400 |
|
1395 | 1401 |
owner = component['Owner'] if component['Owner'] is not None and component['Owner'] != 'None' else None |
1396 | 1402 |
|
1397 |
#hasInstrumentLabelNode = component['HasInstrumentLabel'] |
|
1398 | 1403 |
hasInstrumentLabel = dbData.hasInstrumentLabel |
1399 | 1404 |
|
1400 | 1405 |
flipLabelNode = component['Flip'] |
내보내기 Unified diff