개정판 5ebe1a1f
symbol replace change
Change-Id: I810b5f04429206aa48cbc988de1a8a55d28e18dd
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
173 | 173 |
# up to here |
174 | 174 |
|
175 | 175 |
# connect signals and slots |
176 |
# action no more used |
|
176 | 177 |
#self.actionClose.triggered.connect(self.close) |
177 | 178 |
#self.actionOpen.triggered.connect(self.open_image_drawing) |
178 | 179 |
#self.actionExportAsSVG.triggered.connect(self.export_as_svg) |
... | ... | |
3050 | 3051 |
|
3051 | 3052 |
symbolItems = [symbol for symbol in self.graphicsView.scene().selectedItems() if |
3052 | 3053 |
issubclass(type(symbol), SymbolSvgItem)] |
3053 |
old_symbol = None |
|
3054 |
if symbolItems and len(symbolItems) is 1: |
|
3055 |
old_symbol = symbolItems[0] |
|
3056 |
#scenePos = QPoint(old_symbol.origin[0], old_symbol.origin[1]) |
|
3057 |
scenePos = old_symbol.mapToScene(old_symbol.transformOriginPoint()) |
|
3058 |
old_symbol.transfer.onRemoved.emit(old_symbol) |
|
3054 |
old_symbols = [] |
|
3055 |
if symbolItems and len(symbolItems) >= 1: |
|
3056 |
for old_symbol in symbolItems: |
|
3057 |
#old_symbol = symbolItems[0] |
|
3058 |
#scenePos = QPoint(old_symbol.origin[0], old_symbol.origin[1]) |
|
3059 |
scenePos = old_symbol.mapToScene(old_symbol.transformOriginPoint()) |
|
3060 |
old_symbols.append([old_symbol, scenePos]) |
|
3061 |
old_symbol.transfer.onRemoved.emit(old_symbol) |
|
3059 | 3062 |
else: |
3060 | 3063 |
scenePos = self.current_pos |
3064 |
old_symbols.append([None, scenePos]) |
|
3061 | 3065 |
|
3062 |
svg = QtImageViewer.createSymbolObject(symName) |
|
3063 |
QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, scenePos, angle=old_symbol.angle if old_symbol else 0.0) |
|
3066 |
for old_symbol in old_symbols: |
|
3067 |
svg = QtImageViewer.createSymbolObject(symName) |
|
3068 |
QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, old_symbol[1], angle=old_symbol[0].angle if old_symbol[0] else 0.0) |
|
3069 |
svg.bind_close_items() |
|
3064 | 3070 |
|
3065 |
if old_symbol and svg: |
|
3071 |
if old_symbols and svg:
|
|
3066 | 3072 |
from ReplaceCommand import ReplaceCommand |
3067 | 3073 |
|
3068 |
cmd = ReplaceCommand(self.graphicsView.scene(), old_symbol, svg) |
|
3069 |
self._scene.undo_stack.push(cmd) |
|
3074 |
for old_symbol in old_symbols: |
|
3075 |
cmd = ReplaceCommand(self.graphicsView.scene(), old_symbol, svg) |
|
3076 |
self._scene.undo_stack.push(cmd) |
|
3070 | 3077 |
return |
3071 | 3078 |
elif event.key() == Qt.Key_J: |
3072 | 3079 |
# insert and connect symbol item that is selected symbol in tree to selected symbol |
내보내기 Unified diff