프로젝트

일반

사용자정보

개정판 1f45633d

ID1f45633da0c1b38dfc8036bb66711e745c064983
상위 3e944cfe
하위 d1576bff

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

actionLine 에 Checkable 속성 추가 / ActionGroup.triggered Signal 을 이용하여 이미 선택한 Checkable Action의 체크상태가 해제되게끔 수정

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
65 65
                    Jeongwoo 2018.04.27 Add Signal/Slot Connection 'noteNoSingleClicked'
66 66
                    Jeongwoo 2018.05.09 Initialize Action group
67 67
                    Jeongwoo 2018.05.10 Add Signal/Slot Connection 'lineNoSingleClicked'
68
                                        Add QActionGroup for managing checkable action
68 69
    '''
69 70
    def __init__(self):
70 71
        super(self.__class__, self).__init__()
71 72
        self.setupUi(self)
72 73

  
74
        self.lastClickedCheckableAction = None
75

  
73 76
        project = AppDocData.instance().getCurrentProject()
74 77
        _translate = QCoreApplication.translate
75 78
        self.setWindowTitle(_translate("Digital P&ID - {}".format(project.name), "Digital P&ID - {}".format(project.name)))
......
122 125

  
123 126
        # Initialize Action group
124 127
        actionGroup = QActionGroup(self)
125
        #actionGroup.setExclusive(False)
126 128
        actionGroup.addAction(self.actionRecognition)
127 129
        actionGroup.addAction(self.actionLineRecognition)
128 130
        actionGroup.addAction(self.actionEquipment)
......
130 132
        actionGroup.addAction(self.actionLine)
131 133
        actionGroup.addAction(self.actionGenerateOutput)
132 134
        actionGroup.addAction(self.actionOCR)
133
        #actionGroup.triggered.connect(self.actionGroupTriggered)
135
        actionGroup.triggered.connect(self.actionGroupTriggered)
134 136

  
135 137
        # connect signals and slots
136 138
        self.actionClose.triggered.connect(self.close)
......
151 153
        self.actionNozzle.triggered.connect(self.createNozzle)
152 154
        self.graphicsView.scene.changed.connect(lambda: self.resultTreeWidget.sceneChanged(self.graphicsView.scene.items()))
153 155

  
154
    #def actionGroupTriggered(self, action):
155
    #    if action.isChecked():
156
    #        action.setChecked(False)
156
    '''
157
        @brief      Manage Checkable Action statement
158
        @author     Jeongwoo
159
        @date       2018.05.10
160
    '''
161
    def actionGroupTriggered(self, action):
162
        if self.lastClickedCheckableAction is not None and self.lastClickedCheckableAction == action and action.isChecked():
163
            action.setChecked(False)
164
            self.lastClickedCheckableAction = None
165
        elif action.isCheckable():
166
            self.lastClickedCheckableAction = action
167
        else:
168
            if self.lastClickedCheckableAction is not None:
169
                self.lastClickedCheckableAction.setChecked(False)
170
            self.lastClickedCheckableAction = None
157 171

  
158 172
    '''
159 173
        @brief      Create Equipment
......
419 433
    '''
420 434
        @brief  create a line
421 435
        @author humkyung
436
        @history    2018.05.10  Jeongwoo    Change method for Checkable action
422 437
    '''
423
    def createLine(self):
424
        # set imageviewer's command
425
        self.graphicsView.command = CreateCommand.CreateCommand(self.graphicsView, QEngineeringLineItem())
426
        # up to here
438
    def createLine(self):        
439
        if not self.graphicsView.hasImage():
440
            self.actionLine.setChecked(False)
441
            self.showImageSelectionMessageBox()
442
            return
443
        if self.actionLine.isChecked():
444
            self.graphicsView.command = CreateCommand.CreateCommand(self.graphicsView, QEngineeringLineItem())
445
        else:
446
            self.graphicsView.useDefaultCommand()
427 447

  
428 448
    '''
429 449
        @brief      recognize symbol and text

내보내기 Unified diff

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