개정판 e0b353b4
issue fix text item remove
Change-Id: Iac6df9616402afe18994d660b29e689852026c65
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
2543 | 2543 |
remove_scene = item.scene() |
2544 | 2544 |
self.itemTreeWidget.itemRemoved(item) |
2545 | 2545 |
|
2546 |
matches = [_item for _item in remove_scene.items() if |
|
2547 |
hasattr(_item, 'connectors') and [connector for connector in _item.connectors if |
|
2548 |
connector.connectedItem is item]] |
|
2549 |
for match in matches: |
|
2550 |
for connector in match.connectors: |
|
2551 |
if connector.connectedItem is item: |
|
2552 |
connector.connectedItem = None |
|
2553 |
connector.highlight(False) |
|
2546 |
if remove_scene: |
|
2547 |
matches = [_item for _item in remove_scene.items() if |
|
2548 |
hasattr(_item, 'connectors') and [connector for connector in _item.connectors if |
|
2549 |
connector.connectedItem is item]] |
|
2550 |
for match in matches: |
|
2551 |
for connector in match.connectors: |
|
2552 |
if connector.connectedItem is item: |
|
2553 |
connector.connectedItem = None |
|
2554 |
connector.highlight(False) |
|
2554 | 2555 |
|
2555 | 2556 |
# matches = [_item for _item in self.graphicsView.scene().items() if hasattr(_item, 'remove_assoc_item')] |
2556 | 2557 |
# for _item in matches: |
... | ... | |
2563 | 2564 |
if type(item) is QEngineeringLineItem and item in app_doc_data.lines: |
2564 | 2565 |
app_doc_data.lines.remove(item) |
2565 | 2566 |
|
2566 |
matches = [_item for _item in remove_scene.items() if |
|
2567 |
type(_item) is QEngineeringLineNoTextItem] |
|
2568 |
matches.extend([lineNo for lineNo in app_doc_data.tracerLineNos if |
|
2569 |
type(lineNo) is QEngineeringTrimLineNoTextItem]) |
|
2570 |
for match in matches: |
|
2571 |
if item is match.prop('From'): |
|
2572 |
match.set_property('From', None) |
|
2573 |
if item is match.prop('To'): |
|
2574 |
match.set_property('To', None) |
|
2575 |
|
|
2576 |
for run_index in reversed(range(len(match.runs))): |
|
2577 |
run = match.runs[run_index] |
|
2578 |
if item in run.items: |
|
2579 |
index = run.items.index(item) |
|
2580 |
run.items.pop(index) |
|
2581 |
if not run.items: |
|
2582 |
run.explode() |
|
2583 |
if type(match) is QEngineeringTrimLineNoTextItem and not match.runs: |
|
2584 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(match)) |
|
2585 |
# break |
|
2586 |
|
|
2587 |
matches = [_item for _item in remove_scene.items() if hasattr(_item, 'owner')] |
|
2588 |
for match in matches: |
|
2589 |
if match.owner is item: |
|
2590 |
match.owner = None |
|
2591 |
|
|
2592 |
matches = [_item for _item in remove_scene.items() if hasattr(_item, 'attrs')] |
|
2593 |
# done = False |
|
2594 |
for match in matches: |
|
2595 |
assocs = match.associations() |
|
2596 |
for assoc in assocs: |
|
2597 |
if item is assoc: |
|
2598 |
keys = match.attrs.keys() |
|
2599 |
for attr in keys: |
|
2600 |
if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid): |
|
2601 |
attr.AssocItem = None |
|
2602 |
match.attrs[attr] = '' |
|
2603 |
# done = True |
|
2604 |
match.remove_assoc_item(item) |
|
2605 |
break |
|
2606 |
# if done: break |
|
2567 |
if remove_scene: |
|
2568 |
matches = [_item for _item in remove_scene.items() if |
|
2569 |
type(_item) is QEngineeringLineNoTextItem] |
|
2570 |
matches.extend([lineNo for lineNo in app_doc_data.tracerLineNos if |
|
2571 |
type(lineNo) is QEngineeringTrimLineNoTextItem]) |
|
2572 |
for match in matches: |
|
2573 |
if item is match.prop('From'): |
|
2574 |
match.set_property('From', None) |
|
2575 |
if item is match.prop('To'): |
|
2576 |
match.set_property('To', None) |
|
2577 |
|
|
2578 |
for run_index in reversed(range(len(match.runs))): |
|
2579 |
run = match.runs[run_index] |
|
2580 |
if item in run.items: |
|
2581 |
index = run.items.index(item) |
|
2582 |
run.items.pop(index) |
|
2583 |
if not run.items: |
|
2584 |
run.explode() |
|
2585 |
if type(match) is QEngineeringTrimLineNoTextItem and not match.runs: |
|
2586 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(match)) |
|
2587 |
# break |
|
2588 |
|
|
2589 |
if remove_scene: |
|
2590 |
matches = [_item for _item in remove_scene.items() if hasattr(_item, 'owner')] |
|
2591 |
for match in matches: |
|
2592 |
if match.owner is item: |
|
2593 |
match.owner = None |
|
2594 |
|
|
2595 |
matches = [_item for _item in remove_scene.items() if hasattr(_item, 'attrs')] |
|
2596 |
# done = False |
|
2597 |
for match in matches: |
|
2598 |
assocs = match.associations() |
|
2599 |
for assoc in assocs: |
|
2600 |
if item is assoc: |
|
2601 |
keys = match.attrs.keys() |
|
2602 |
for attr in keys: |
|
2603 |
if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid): |
|
2604 |
attr.AssocItem = None |
|
2605 |
match.attrs[attr] = '' |
|
2606 |
# done = True |
|
2607 |
match.remove_assoc_item(item) |
|
2608 |
break |
|
2609 |
# if done: break |
|
2607 | 2610 |
|
2608 | 2611 |
if item.scene() is not None: item.scene().removeItem(item) |
2609 | 2612 |
except Exception as ex: |
내보내기 Unified diff