개정판 c8cfe260
issue #643: condition replace test
Change-Id: Id8e3ef746fd94e3ce4ed93189f64f256f0b56562
DTI_PID/DTI_PID/ReplaceSymbolDialog.py | ||
---|---|---|
40 | 40 |
find_symbol = self.ui.comboBoxFind.currentText() |
41 | 41 |
replace_symbol = self.ui.comboBoxReplace.currentText() |
42 | 42 |
|
43 |
conditions = [[text for text in self.ui.plainTextEdit.toPlainText().split('\n')]]
|
|
43 |
conditions = [text for text in self.ui.plainTextEdit.toPlainText().split('\n')]
|
|
44 | 44 |
|
45 | 45 |
if self.ui.radioButtonReplace.isChecked(): |
46 | 46 |
# replace |
... | ... | |
52 | 52 |
return |
53 | 53 |
|
54 | 54 |
for old_symbol in symbol_items: |
55 |
target = False
|
|
55 |
target = True
|
|
56 | 56 |
for condition in conditions: |
57 | 57 |
if not eval(condition): |
58 |
target = False |
|
58 | 59 |
break |
59 | 60 |
if not target: |
60 | 61 |
continue |
61 | 62 |
|
62 | 63 |
scenePos = old_symbol.mapToScene(old_symbol.transformOriginPoint()) |
63 | 64 |
old_symbol.transfer.onRemoved.emit(old_symbol) |
64 |
|
|
65 |
|
|
65 | 66 |
svg = self.view.createSymbolObject(replace_symbol) |
66 | 67 |
self.view.matchSymbolToLine(svg, scenePos, angle=old_symbol.angle, flip=old_symbol.flip) |
67 | 68 |
svg.bind_close_items() |
내보내기 Unified diff