프로젝트

일반

사용자정보

개정판 353a007d

ID353a007d953e7af9aa9c627277c7c93497256a55
상위 4c632ac9
하위 94432810

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

issue #622: save check change, ask only not save, disable close saving

Change-Id: I9d0120fd8e0ce87db81471fc29234c94f688c603

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
347 347
    def closeEvent(self, event):
348 348
        """ask user to save drawing which is modified"""
349 349

  
350
        self.save_drawing_if_necessary()
350
        #self.save_drawing_if_necessary()
351 351
        AppDocData.instance().clear()
352 352
        event.accept()
353 353

  
......
687 687
            if QMessageBox.Yes == QMessageBox.question(self, self.tr("Question"),
688 688
                                                       self.tr("Do you want to save drawing?"),
689 689
                                                       QMessageBox.Yes | QMessageBox.No):
690
                self.actionSaveCliked()
690
                #self.actionSaveCliked()
691
                return True
691 692

  
692 693
    '''
693 694
        @brief      action save click event
......
1331 1332
            if not self.actionSave.isEnabled():
1332 1333
                return
1333 1334

  
1334
            self.save_drawing_if_necessary()
1335
            if self.save_drawing_if_necessary():
1336
                return
1337

  
1335 1338
            if hasattr(self, '_save_work_cmd'):
1336 1339
                self._save_work_cmd.wait()
1337 1340

  
DTI_PID/DTI_PID/Shapes/QEngineeringOPCItem.py
114 114
                        attr.owner = self
115 115
            '''
116 116

  
117
            attrs = self.getAttributes()
118
            attr_num = len(attrs)
119

  
117 120
            configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio')
118 121
            ratio = float(configs[0].value) if 1 == len(configs) else 1.5
119 122

  
120 123
            dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width()) * ratio / 5
121 124
            center = self.sceneBoundingRect().center()
122 125

  
123
            minDists = [[sys.maxsize, None], [sys.maxsize, None], [sys.maxsize, None]]
126
            minDists = []
127
            for index in range(attr_num + 1):
128
                minDists.append([sys.maxsize, None])
124 129

  
125 130
            for attr in attributes:
126 131
                if type(attr) is QEngineeringTextItem and attr.owner is None:
......
128 133
                    dy = attr.center().y() - center.y()
129 134
                    length = math.sqrt(dx * dx + dy * dy)
130 135
                    if length < dist:
131
                        minDists.pop(2)
132
                        minDists.insert(2, [length, attr])
136
                        minDists.pop(attr_num)
137
                        minDists.insert(attr_num, [length, attr])
133 138
                        minDists = sorted(minDists, key=lambda minDist: minDist[0])
134 139

  
135
            minDists.pop(2)
140
            minDists.pop(attr_num)
136 141
            for attr in minDists:
137 142
                if attr[1]:
138 143
                    if self.add_assoc_item(attr[1]):

내보내기 Unified diff

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