프로젝트

일반

사용자정보

개정판 bc42255c

IDbc42255c283bc3e40532b7557069a1c6778da290
상위 5707da6d
하위 69b1c8c1

함의성이(가) 5년 이상 전에 추가함

issue #587: add delete attr

Change-Id: If56c3ee204ad7e604c8f9a507e63e39c833cf9b3

차이점 보기:

DTI_PID/DTI_PID/ItemPropertyTableWidget.py
812 812
        @date       2018.07.19
813 813
    '''
814 814
    def keyPressEvent(self, event):
815
        from SymbolAttr import SymbolAttr
816

  
815 817
        if event.key() == Qt.Key_Delete:
816 818
            items = self.mainWindow.graphicsView.scene.selectedItems()
817 819
            selectedIndexes = self.selectedIndexes()
818 820
            if selectedIndexes[0].column() == 3 and self.item(selectedIndexes[0].row(), 1).text() == 'OWNER':
819 821
                items[0].owner = None
820 822
                self.show_item_property(items[0])
821
            elif len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is not QEngineeringLineItem and type(items[0]) is not QEngineeringSpecBreakItem and self.item(selectedIndexes[0].row(), 1).text().find('CONN') is not 0:
822
                if selectedIndexes[0].column() == 3:
823
                    attributeStr = self.item(selectedIndexes[0].row(), 1).text()
824
                    items[0].removeSelfAttr(attributeStr)
825
                    self.mainWindow.refreshResultPropertyTableWidget()
823
            #elif len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is not QEngineeringLineItem and type(items[0]) is not QEngineeringSpecBreakItem and self.item(selectedIndexes[0].row(), 1).text().find('CONN') is not 0:
824
            #    if selectedIndexes[0].column() == 3:
825
            #        attributeStr = self.item(selectedIndexes[0].row(), 1).text()
826
            #        items[0].removeSelfAttr(attributeStr)
827
            #        self.mainWindow.refreshResultPropertyTableWidget()
826 828
            elif len(items) == 1 and len(selectedIndexes) == 1 and (type(items[0]) is QEngineeringLineItem or issubclass(type(items[0]), SymbolSvgItem)):
827 829
                key_cell = self.item(selectedIndexes[0].row(), 1)
830
                data = key_cell.data(Qt.UserRole)
828 831
                if selectedIndexes[0].column() == 3 and key_cell.text().find('CONN') is 0:
829 832
                    selectedUID = self.item(selectedIndexes[0].row(), 1).text()
830 833
                    connNum = int(key_cell.text().replace('CONN', ''))
......
836 839
                            for sceneConnector in sceneItem.connectors:
837 840
                                if sceneConnector.connectedItem is not None and items[0].uid == sceneConnector.connectedItem.uid:
838 841
                                    sceneConnector.connectedItem = None
842
                elif selectedIndexes[0].column() == 3 and data and type(data) is SymbolAttr:
843
                    for _attr,_value in items[0].attrs.items():
844
                        if str(_attr.UID) == str(data.UID):
845
                            items[0].remove_assoc_item(_attr.AssocItem)
846
                            if type(_attr.AssocItem) is QEngineeringTextItem:
847
                                _attr.AssocItem.owner = None
848
                            _attr.AssocItem = None
849
                            items[0].attrs[_attr] = ''
850
                            self.show_item_property(items[0])
851
                            break
839 852
            elif len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is QEngineeringSpecBreakItem:
840 853
                keyCell = self.item(selectedIndexes[0].row(), 1)
841 854
                if selectedIndexes[0].column() == 3 and (keyCell.text() == 'UpStream' or keyCell.text() == 'DownStream'):

내보내기 Unified diff

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