프로젝트

일반

사용자정보

개정판 827cf144

ID827cf1447a558af8db85388f1f3d1f7217627747
상위 af2b9605
하위 dcd9987a, 3b21870b

함의성이(가) 약 6년 전에 추가함

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

클립보드 이미지 추가 (최대 크기: 500 MB)