프로젝트

일반

사용자정보

개정판 2894ed79

ID2894ed79cd8f115829682d1258127f93b2b91baa
상위 b6406480
하위 406f883d, 7b2a4455

김정우 이(가) 6년 이상 전에 추가함

주석 추가 및 QDirTreeWidget 아이템 클릭/ContextMenu 조건 추가하여 Type 아이템에서는 동작하지 않도록 변경

차이점 보기:

DTI_PID/DTI_PID/App.py
36 36
        finally:
37 37
            file.close()
38 38

  
39
'''
40
    @history    18.04.23    Jeongwoo    Change method to execute ProjectDialog(dlg.exec_()→dlg.showDialog())
41
'''
39 42
if __name__ == '__main__':
40 43
    import DTI_PID_UI
41 44
    from ProjectDialog import Ui_Dialog
DTI_PID/DTI_PID/QDirTreeWidget.py
31 31
        self.setContextMenuPolicy(Qt.CustomContextMenu)
32 32
        self.customContextMenuRequested.connect(self.openContextMenu)
33 33
            
34
    '''
35
        @brief      Show Context Menu
36
        @author     Jeongwoo
37
        @date       18.04.??
38
        @history    18.04.23    Jeongwoo    Symbol object Null Check when show context menu
39
    '''
34 40
    def openContextMenu(self, position):
35 41
        indexes = self.selectedIndexes()
36 42
        itemPosition = self.mapTo(self, position)
......
43 49
            while index.parent().isValid():
44 50
                index = index.parent()
45 51
                level += 1
46
        #if text.lower().endswith(".png"):
47
        menu = QMenu()
48
        editSymbolAction = QAction(self.tr("Edit Symbol"))
49
        editSymbolAction.triggered.connect(lambda: self.editSymbolActionClickEvent(item, 0))
50
        menu.addAction(editSymbolAction)
51
        displaySymbolAction = QAction(self.tr("Display Symbol"))
52
        displaySymbolAction.triggered.connect(lambda: self.displaySymbolActionClickEvent(sym.getType(), text))
53
        menu.addAction(displaySymbolAction)
54
        deleteSymbolAction = QAction(self.tr("Delete Symbol"))
55
        deleteSymbolAction.triggered.connect(lambda: self.deleteSymbolActionClickEvent(sym.getType(), text))
56
        menu.addAction(deleteSymbolAction)
57
        menu.exec_(self.viewport().mapToGlobal(position))
52
        if sym is not None:
53
            menu = QMenu()
54
            editSymbolAction = QAction(self.tr("Edit Symbol"))
55
            editSymbolAction.triggered.connect(lambda: self.editSymbolActionClickEvent(item, 0))
56
            menu.addAction(editSymbolAction)
57
            displaySymbolAction = QAction(self.tr("Display Symbol"))
58
            displaySymbolAction.triggered.connect(lambda: self.displaySymbolActionClickEvent(sym.getType(), text))
59
            menu.addAction(displaySymbolAction)
60
            deleteSymbolAction = QAction(self.tr("Delete Symbol"))
61
            deleteSymbolAction.triggered.connect(lambda: self.deleteSymbolActionClickEvent(sym.getType(), text))
62
            menu.addAction(deleteSymbolAction)
63
            menu.exec_(self.viewport().mapToGlobal(position))
58 64

  
59 65
    def editSymbolActionClickEvent(self, item, columNo):
60 66
        self.showSymbolEditorDialog(item, columNo)
......
178 184

  
179 185
    def itemDoubleClickEvent(self, item, columnNo):
180 186
        self.isDoubleClicked = True
187
        sym = self.getSymbolByItemName(item, columnNo)
181 188
        itemName = item.text(columnNo)
182 189
        print(itemName + " : Double Clicked")
183
        self.showSymbolEditorDialog(item, columnNo)
190
        if sym is not None:
191
            self.showSymbolEditorDialog(item, columnNo)
184 192
        self.isDoubleClicked = False
185 193

  
186 194
    def itemClickEvent(self, item, columnNo):
......
189 197
            sym = self.getSymbolByItemName(item, columnNo)
190 198
            if sym is not None:
191 199
                self.singleClicked.emit(sym)
192
            else:
193
                QMessageBox.about(self, "알림", "심볼 데이터를 불러오는 중 에러가 발생했습니다.")
200
            #else:
201
            #    QMessageBox.about(self, "알림", "심볼 데이터를 불러오는 중 에러가 발생했습니다.")
194 202

  
195 203
    '''
196 204
        @brief      Get Symbol data by symbol name

내보내기 Unified diff

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