프로젝트

일반

사용자정보

개정판 1d33681d

ID1d33681dc09db2e6ae51d0615b953b139b80cb4d
상위 2dd894e3
하위 31958dce

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

issue #503: bug fixed before save

차이점 보기:

DTI_PID/DTI_PID/ConfigurationAreaDialog.py
34 34
        for index in range(self.ui.tableWidgetEquipmentDescArea.columnCount()):
35 35
            self.ui.tableWidgetEquipmentDescArea.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
36 36
            self.ui.tableWidgetEquipmentDescArea.setColumnWidth(index, len(self.ui.tableWidgetEquipmentDescArea.horizontalHeaderItem(index).text()) * 8 + 10)
37
        self.ui.tableWidgetTitleBlockArea.setColumnCount(2)
38
        self.ui.tableWidgetTitleBlockArea.setHorizontalHeaderLabels(['Name', 'Area'])
37
        self.ui.tableWidgetTitleBlockArea.setColumnCount(3)
38
        self.ui.tableWidgetTitleBlockArea.setHorizontalHeaderLabels(['UID', 'Name', 'Area'])
39 39
        for index in range(self.ui.tableWidgetTitleBlockArea.columnCount()):
40 40
            self.ui.tableWidgetTitleBlockArea.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
41 41
            self.ui.tableWidgetTitleBlockArea.setColumnWidth(index, len(self.ui.tableWidgetTitleBlockArea.horizontalHeaderItem(index).text()) * 8 + 10)
42
        self.ui.tableWidgetTitleBlockArea.hideColumn(0)
42 43
        self.isAccepted = False
43 44
        self._cmd = FenceCommand.FenceCommand(self.parent().graphicsView)
44 45
        self._cmd.onSuccess.connect(self.onAreaCreated)
......
115 116
            boundingBox.setPen(QPen(Qt.darkCyan, THICKNESS, Qt.SolidLine))
116 117
            self.parent().graphicsView.scene.addItem(boundingBox)
117 118

  
118
            item = QTableWidgetItem(docData.imgName)
119
            item.setFlags(Qt.ItemIsEnabled)
119
            item = QTableWidgetItem(titleBlockProp[0])
120 120
            self.ui.tableWidgetTitleBlockArea.setItem(row, 0, item)
121
            item = QTableWidgetItem(titleBlockProp[1])
122
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsEditable)
123
            self.ui.tableWidgetTitleBlockArea.setItem(row, 1, item)
121 124
            item = QTableWidgetItem('({},{}),({},{})'.format(area.x, area.y, area.width, area.height))
122 125
            item.setFlags(Qt.ItemIsEnabled)
123 126
            item.tag = boundingBox
124
            self.ui.tableWidgetTitleBlockArea.setItem(row, 1, item)
127
            self.ui.tableWidgetTitleBlockArea.setItem(row, 2, item)
125 128
            row += 1
126 129

  
127 130
        #self.ui.pushButtonAdd.setStyleSheet('background-color: darkGray')
......
160 163
        self.ui.pushButtonDrawingNoArea.clicked.connect(self.selectDrawingNoArea)
161 164
        self.ui.pushButtonRevNoArea.clicked.connect(self.selectRevNoArea)
162 165
        self.ui.pushButtonUnitArea.clicked.connect(self.onSelectUnitArea)
166
        self.ui.pushButtonAddTitleBlockProp.clicked.connect(self.onSelectTitleBlockArea)
167
        self.ui.pushButtonDelTitleBlockProp.clicked.connect(self.onDeleteTitleBlockArea)
163 168
        self.ui.pushButtonAdd.clicked.connect(self.onSelectEquipmentDescArea)
164 169
        self.ui.pushButtonDel.clicked.connect(self.onDeleteEquipmentDescArea)
165 170

  
......
187 192
        self._cmd.tag = self.ui.lineEditRevNo
188 193
        self.parent().graphicsView.command = self._cmd
189 194

  
195
    def onSelectTitleBlockArea(self):
196
        '''
197
        @brief  select title block area
198
        @author euisung
199
        @date   2018.11.09
200
        '''
201
        self._cmd.tag = self.ui.tableWidgetTitleBlockArea
202
        self.parent().graphicsView.command = self._cmd
203

  
204
    def onDeleteTitleBlockArea(self):
205
        '''
206
        @brief  delete selected title block area
207
        @author euisung
208
        @date   2018.11.09
209
        '''
210
        try:
211
            row = self.ui.tableWidgetTitleBlockArea.currentRow()
212
            self.removeArea(self.ui.tableWidgetEquipmentDescArea.item(row, 1).tag)
213
            self.ui.tableWidgetTitleBlockArea.removeRow(row)
214
        except Exception as ex:
215
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
216

  
190 217
    '''
191 218
        @brief  select equipment desc area
192 219
        @author humkyung
......
200 227
        @brief  remove equipment desc. area from graphicsview
201 228
        @author humkyung
202 229
        @date   2018.06.29
230
        @history    2018.11.09      euisung     change name removeEquipmentDescArea -> removeArea for title block
203 231
    '''
204
    def removeEquipmentDescArea(self, area):
232
    def removeArea(self, box):
205 233
        import re
206 234

  
207 235
        try:
208
            found = re.findall('\d+',area)
209
            item = self.parent().graphicsView.scene.itemAt(float(int(found[0])), float(int(found[1])), QTransform())
210
            if item is not None:
211
                self.parent().graphicsView.scene.removeItem(item)
236
            self.parent().graphicsView.scene.removeItem(box)
212 237
        except Exception as ex:
213 238
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
214 239

  
......
220 245
    def onDeleteEquipmentDescArea(self):
221 246
        try:
222 247
            row = self.ui.tableWidgetEquipmentDescArea.currentRow()
223
            area = self.ui.tableWidgetEquipmentDescArea.item(row, 1).text()
224
            self.removeEquipmentDescArea(area)
248
            self.removeArea(self.ui.tableWidgetEquipmentDescArea.item(row, 1).tag)
225 249
            self.ui.tableWidgetEquipmentDescArea.removeRow(row)
226 250
        except Exception as ex:
227 251
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
......
231 255
        @history    humkyung 2018.06.29 add equipment desc. area
232 256
    '''
233 257
    def onAreaCreated(self, x, y , width, height):
258
        import uuid
234 259
        THICKNESS = 5
235 260

  
236 261
        if self._cmd.tag is self.ui.lineEditDrawing:
......
324 349
            self.ui.tableWidgetEquipmentDescArea.setItem(row, 1, item)
325 350
            self.ui.tableWidgetEquipmentDescArea.resizeColumnsToContents()
326 351
            # up to here
352
        elif self._cmd.tag is self.ui.tableWidgetTitleBlockArea:
353
            x, y = round(x), round(y)
354
            width, height = round(width), round(height)
355

  
356
            boundingBox = QGraphicsBoundingBoxItem(x, y, width, height)
357
            #boundingBox.transfer.onSizeChanged.connect(self.onSizeChanged)
358
            boundingBox.setPen(QPen(Qt.darkGray, THICKNESS, Qt.SolidLine))
359
            self.parent().graphicsView.scene.addItem(boundingBox)
360

  
361
            # add item to table widget
362
            strArea = '({},{}),({},{})'.format(x, y, width, height)
363
            docData = AppDocData.instance()
364
            row = self.ui.tableWidgetTitleBlockArea.rowCount()
365
            self.ui.tableWidgetTitleBlockArea.setRowCount(row + 1)
366
            item = QTableWidgetItem(str(uuid.uuid4()))
367
            self.ui.tableWidgetTitleBlockArea.setItem(row, 0, item)
368
            item = QTableWidgetItem()
369
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsEditable)
370
            self.ui.tableWidgetTitleBlockArea.setItem(row, 1, item)
371
            item = QTableWidgetItem(strArea)
372
            item.setFlags(Qt.ItemIsEnabled)
373
            item.tag = boundingBox
374
            self.ui.tableWidgetTitleBlockArea.setItem(row, 2, item)
375
            self.ui.tableWidgetTitleBlockArea.resizeColumnsToContents()
376
            # up to here
327 377

  
328 378
        self.parent().graphicsView.command = None
329 379

  
......
431 481
                area.parse(self.ui.tableWidgetEquipmentDescArea.item(row, 1).text())
432 482
                configs.append(Config(section, str(row), area.toString()))
433 483

  
434
                self.removeEquipmentDescArea(area.toString())
484
                self.removeArea(self.ui.tableWidgetEquipmentDescArea.item(row, 1).tag)
435 485
            # up to here
436 486
            docData.saveConfigs(configs)
437 487

  
......
466 516
            self.parent().graphicsView.scene.removeItem(self.ui.lineEditRevNo.tag)
467 517

  
468 518
        for row in range(self.ui.tableWidgetEquipmentDescArea.rowCount()):
469
            area = Area('Equipment Desc.')
470
            area.parse(self.ui.tableWidgetEquipmentDescArea.item(row, 1).text())
471
            self.removeEquipmentDescArea(area.toString())
519
            self.removeArea(self.ui.tableWidgetEquipmentDescArea.item(row, 1).tag)
472 520

  
473 521
        QDialog.reject(self)

내보내기 Unified diff

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