개정판 f145d925
add symbol align function
Change-Id: Ie204355ce29f49a2a57b96cc8d57f51f4fde9972
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
1304 | 1304 |
allAction.triggered.connect(self.contextSelectAll) |
1305 | 1305 |
menu.addAction(allAction) |
1306 | 1306 |
|
1307 |
alignAction = QAction('Align Selected Symbols', None) |
|
1308 |
alignAction.triggered.connect(self.contextAlignSymbol) |
|
1309 |
menu.addAction(alignAction) |
|
1310 |
|
|
1307 | 1311 |
mergeAction = QAction('Make Line(M)', None) |
1308 | 1312 |
mergeAction.triggered.connect(self.contextMerge) |
1309 | 1313 |
menu.addAction(mergeAction) |
... | ... | |
1372 | 1376 |
cmd.onSuccess.connect(App.mainWnd().resultPropertyTableWidget.onSuccessSelectAttribute) |
1373 | 1377 |
App.mainWnd().graphicsView.command = cmd |
1374 | 1378 |
|
1379 |
def contextAlignSymbol(self): |
|
1380 |
scene = self.scene() |
|
1381 |
if scene: |
|
1382 |
symbolItems = [symbol for symbol in scene.selectedItems() if symbol is not self and issubclass(type(symbol), SymbolSvgItem)] |
|
1383 |
|
|
1384 |
for symbol in symbolItems: |
|
1385 |
dx = self.origin[0] - symbol.origin[0] |
|
1386 |
dy = self.origin[1] - symbol.origin[1] |
|
1387 |
if abs(dx) > abs(dy): |
|
1388 |
if dx > 0: |
|
1389 |
symbol.moveBy(0, dy) |
|
1390 |
else: |
|
1391 |
symbol.moveBy(0, dy) |
|
1392 |
else: |
|
1393 |
if dy > 0: |
|
1394 |
symbol.moveBy(dx, 0) |
|
1395 |
else: |
|
1396 |
symbol.moveBy(dx, 0) |
|
1397 |
|
|
1375 | 1398 |
def contextMove(self): |
1376 | 1399 |
self.move_near_main_line() |
1377 | 1400 |
|
내보내기 Unified diff