개정판 827cf144
issus #000: delete assc when remove item
Change-Id: I98f1d4e80a4bb0e189a0d880074c6f09d26b570e
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
148 | 148 |
menu.addAction(pickColorAction) |
149 | 149 |
explode_action = QAction(self.tr("Explode")) |
150 | 150 |
freeze = data.prop('Freeze') |
151 |
print(freeze) |
|
151 |
#print(freeze)
|
|
152 | 152 |
explode_action.setEnabled(not freeze) |
153 | 153 |
explode_action.triggered.connect(lambda : self.explode_line_no(item)) |
154 | 154 |
menu.addAction(explode_action) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1547 | 1547 |
try: |
1548 | 1548 |
self.itemTreeWidget.itemRemoved(item) |
1549 | 1549 |
|
1550 |
''' |
|
1550 | 1551 |
if type(item) is QEngineeringLineNoTextItem: |
1551 | 1552 |
self.removedItems['LINE'].append(str(item.uid)) |
1552 | 1553 |
elif type(item) is QEngineeringInstrumentItem: |
... | ... | |
1555 | 1556 |
self.removedItems['EQUIP'].append(str(item.uid)) |
1556 | 1557 |
elif type(item) is QEngineeringNoteItem: |
1557 | 1558 |
self.removedItems['NOTE'].append(str(item.uid)) |
1559 |
''' |
|
1558 | 1560 |
|
1559 | 1561 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'connectors') and [connector for connector in _item.connectors if connector.connectedItem is item]] |
1560 | 1562 |
for match in matches: |
1561 | 1563 |
for connector in match.connectors: |
1562 | 1564 |
if connector.connectedItem is item: connector.connectedItem = None |
1563 | 1565 |
|
1566 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'remove_assoc_item')] |
|
1567 |
for _item in matches: |
|
1568 |
_item.remove_assoc_item(item) |
|
1569 |
|
|
1564 | 1570 |
matches = [_item for _item in self.graphicsView.scene.items() if type(_item) is QEngineeringLineNoTextItem] |
1565 | 1571 |
for match in matches: |
1566 | 1572 |
if item is match.prop('From'): |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
177 | 177 |
|
178 | 178 |
def remove_assoc_item(self, item): |
179 | 179 |
""" remove given item from association """ |
180 |
pass |
|
180 |
_type = QEngineeringAbstractItem.assoc_type(item) |
|
181 |
if _type is not None: |
|
182 |
if _type in self._associations and item in self._associations[_type]: |
|
183 |
index = self._associations[_type].index(item) |
|
184 |
self._associations[_type].pop(index) |
내보내기 Unified diff