프로젝트

일반

사용자정보

개정판 726d4cf2

ID726d4cf20d4369472964af78e1998344a78515ce
상위 83575689
하위 57e3d9dc

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

issue #655: before making traindata

차이점 보기:

DTI_PID/DTI_PID/App.py
69 69
    cv2.imwrite('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI_.png', img)
70 70
    '''
71 71

  
72
    app = App(sys.argv)
72
    app = App(sys.argv) 
73 73
    try:
74 74
        dlg = Ui_Dialog()
75 75
        selectedProject = dlg.showDialog()
DTI_PID/DTI_PID/Commands/DefaultCommand.py
102 102
                    xmlStr = QApplication.clipboard().text()
103 103
                    if xmlStr.find('<SYMBOL>') > -1 and xmlStr.find('</SYMBOL>') > -1:
104 104
                        self.copySymbol(QApplication.clipboard().text())
105

  
106 105
                self.isTreated = False
107 106
            elif self.isCopy and self.isSpecBreak:
108 107
                if 'mouseReleaseEvent' == param[0] and event.button() == Qt.LeftButton:
DTI_PID/DTI_PID/Shapes/TrainingBoxItem.py
26 26

  
27 27
        self.char = char
28 28
        self.uid = uuid.uuid4() if uid is None else uid
29
        self.loc = None
30
        self.size = None
31
        self.angle = 0  # angle in radian
32
        self.conns = []
33
        self._owner = None
34
        self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable)#|QGraphicsItem.ItemIsMovable)
29

  
30
        self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable)
35 31
        self.setAcceptHoverEvents(True)
36 32
        self.setAcceptTouchEvents(True)
37 33
        
38
        self.delimiter = '"'
39
        self.attribute = ''
40
        self.rec = None
41 34
        self.ui = None
42 35
        self.scene = None
43 36
        self.view = None
......
64 57
        self.leftSideView.fitInView(rectSide)
65 58
        self.spinBoxFlag = False
66 59

  
67
    def deleteTextItemFromScene(self):
68
        self.transfer.onRemoved.emit(self)
69
        self.scene.removeItem(self)
70

  
71
    def keyPressEvent(self, event): 
72
        if event.key() == Qt.Key_Delete:
73
            self.deleteTextItemFromScene()
74
        elif event.key() == Qt.Key_R:
75
            #degree 0
76
            if 0 == self.angle:
77
                self.angle = 1.57
78
            #degree 90
79
            elif (1.57 == self.angle):
80
                self.angle = 3.14
81
            #degree 180
82
            elif 3.14 == self.angle:
83
                self.angle = 4.71
84
            #degree 270
85
            elif 4.71 == self.angle :
86
                self.angle = 0
87

  
88
            width = self.size[0]
89
            height = self.size[1]
90
            self.size = (height, width)
91

  
92
            self.rotate()
93

  
94
        QGraphicsRectItem.keyPressEvent(self, event)
95

  
96 60
    def drawFocusRect(self, painter):
97 61
        pen = QPen(Qt.SolidLine)
98 62
        pen.setColor(Qt.blue)
DTI_PID/DTI_PID/TrainingEditorDialog.py
16 16

  
17 17

  
18 18
class QTrainingEditorDialog(QDialog):
19
    def __init__(self, parent, trainingImgPath, trainingBoxPath):
19
    def __init__(self, parent, trainingImgPath, trainingBoxPath, boundaryOcrData):
20 20
        self.spinBoxFlag = False
21 21
        QDialog.__init__(self, parent)
22 22

  
23 23
        self.trainingImgPath = trainingImgPath
24 24
        self.trainingBoxPath = trainingBoxPath
25
        self.boundaryOcrData = boundaryOcrData
25 26

  
26 27
        appDocData = AppDocData.instance()
27 28
        project = appDocData.getCurrentProject()
......
73 74

  
74 75
        # 박스 읽어서 메인 뷰에 그림
75 76
        try:
76
            #trainingBoxPath = os.path.join(project.getTrainingFilePath(), 'seed.seedF.exp0.box')
77
            fBox = open(trainingBoxPath, 'r', encoding='utf8')
78
            SBox = fBox.read()
79
            fBox.close()
80 77
            boxList = []
81
            boxList = SBox.split('\n')
78
            if self.boundaryOcrData is None:
79
                fBox = open(trainingBoxPath, 'r', encoding='utf8')
80
                SBox = fBox.read()
81
                fBox.close()
82
                boxList = SBox.split('\n')
83
            else:
84
                boxList = boundaryOcrData.split('\n')
82 85

  
83 86
            for box in boxList:
87
                if box == '': continue
84 88
                boxComponent = box.split(' ')
85 89
                singleBox = QTrainingBoxItem(str(boxComponent[0]), int(boxComponent[1]), cvImg.shape[0] - int(boxComponent[4]), int(boxComponent[3]) - int(boxComponent[1]), int(boxComponent[4]) - int(boxComponent[2]))
86
                singleBox.loc = [int(boxComponent[1]), cvImg.shape[0] - int(boxComponent[2])]
87
                singleBox.size = [int(boxComponent[3]) - int(boxComponent[1]), int(boxComponent[2]) - int(boxComponent[4])]
88
                singleBox.angle = 0
89 90
                singleBox.transfer.onRemoved.connect(self.itemRemoved)
90 91
                singleBox.addTextItemToScene(self.ui, self.graphicsViewTrainingDrawing, self.graphicsViewZoomDrawing, self.spinBoxFlag)
91 92
            
......
105 106
        self.ui.pushButtonSave.clicked.connect(self.pushButtonSaveClicked)
106 107
        self.ui.pushButtonCancel.clicked.connect(self.pushButtonCancelClicked)
107 108
        self.ui.pushButtonChange.clicked.connect(self.pushButtonChangeClicked)
109
        self.ui.pushButtonDelete.clicked.connect(self.pushButtonDeleteClicked)
110
        self.ui.pushButtonAdd.clicked.connect(self.pushButtonAddClicked)
108 111
        self.ui.spinBoxLeft.valueChanged.connect(self.spinBoxChangedEvent)
109 112
        self.ui.spinBoxTop.valueChanged.connect(self.spinBoxChangedEvent)
110 113
        self.ui.spinBoxWidth.valueChanged.connect(self.spinBoxChangedEvent)
111 114
        self.ui.spinBoxHeight.valueChanged.connect(self.spinBoxChangedEvent)
112 115

  
116
    '''
117
        @brief      add boxitem by button click
118
        @author     euisung
119
        @date       2018.10.17
120
    '''
121
    def pushButtonAddClicked(self):
122
        items = self.graphicsViewTrainingDrawing.scene.selectedItems()
123
        allItems = self.graphicsViewTrainingDrawing.scene.items()
124
        totalWidth = 0
125
        totalHeight = 0
126
        count = 0
127
        if len(items) is 1:
128
            rect = items[0].rect()
129
        elif len(allItems) > 1:
130
            for item in allItems:
131
                if type(item) is QGraphicsPixmapItem:
132
                    x = int(item.boundingRect().width() / 2)
133
                    y = int(item.boundingRect().height()/ 2)
134
                else:
135
                    count += 1
136
                    totalWidth += item.rect().width()
137
                    totalHeight += item.rect().height()
138
            rect = QRectF(x, y, round(totalWidth / count), round(totalHeight / count))
139
        else:
140
            for item in allItems:
141
                if type(item) is QGraphicsPixmapItem:
142
                    x = int(item.boundingRect().width() / 2)
143
                    y = int(item.boundingRect().height()/ 2)
144
            rect = QRectF(x, y, 5, 10)
145
        singleBox = QTrainingBoxItem('', rect.x() + 3, rect.y(), rect.width(), rect.height())
146
        singleBox.transfer.onRemoved.connect(self.itemRemoved)
147
        singleBox.addTextItemToScene(self.ui, self.graphicsViewTrainingDrawing, self.graphicsViewZoomDrawing, self.spinBoxFlag)
148

  
149
    '''
150
        @brief      delete boxitem by button click
151
        @author     euisung
152
        @date       2018.10.17
153
    '''
154
    def pushButtonDeleteClicked(self):
155
        items = self.graphicsViewTrainingDrawing.scene.selectedItems()
156
        for item in items:
157
            item.transfer.onRemoved.emit(item)
158

  
159
    '''
160
        @brief      change boxitem char by button click
161
        @author     euisung
162
        @date       2018.10.17
163
    '''
113 164
    def pushButtonChangeClicked(self):
114 165
        items = self.graphicsViewTrainingDrawing.scene.selectedItems()
115
        if(len(items) is not 1) or self.spinBoxFlag:
166
        if len(items) is not 1:
116 167
            return
117 168
        items[0].char = self.ui.lineEditChar.text()
118 169

  
170
    '''
171
        @brief      close dialog by button click
172
        @author     euisung
173
        @date       2018.10.17
174
    '''
119 175
    def pushButtonCancelClicked(self):
120 176
        QDialog.reject(self)
121 177

  
178
    '''
179
        @brief      save box item by button click
180
        @author     euisung
181
        @date       2018.10.16
182
    '''
122 183
    def pushButtonSaveClicked(self):
123 184
        items = self.graphicsViewTrainingDrawing.scene.items()
124 185
        outBox = ""
......
130 191
            if type(item) is QTrainingBoxItem:
131 192
                rect = item.rect()
132 193
                char, x, y, width, height = item.char, int(rect.x()), int(rect.y()), int(rect.width()), int(rect.height())
133
                bx, by, bx2, by2 = str(x), str(imgHeight - y), str(x + width), str(imgHeight - y - height)
194
                bx, by, bx2, by2 = str(x), str(imgHeight - y - height), str(x + width), str(imgHeight - y)
195
                if char == '':
196
                    continue
134 197
                outBox += char + " " + bx + " " + by + " " + bx2 + " " + by2 + "\n"
135 198
        fw = open(self.trainingBoxPath, 'w')
136 199
        fw.write(outBox)
137 200
        fw.close()
138 201

  
202
    '''
203
        @brief      chane box item's rect by button click
204
        @author     euisung
205
        @date       2018.10.16
206
    '''
139 207
    def spinBoxChangedEvent(self, event):
140 208
        items = self.graphicsViewTrainingDrawing.scene.selectedItems()
141
        if(len(items) is not 1) or self.spinBoxFlag:
209
        if (len(items) is not 1) or self.spinBoxFlag:
142 210
            return
143 211
        
144 212
        spinBoxName = self.sender().objectName()
DTI_PID/DTI_PID/TrainingEditor_UI.py
24 24
        self.pushButtonZoom.setMinimumSize(QtCore.QSize(64, 64))
25 25
        self.pushButtonZoom.setMaximumSize(QtCore.QSize(64, 64))
26 26
        self.pushButtonZoom.setCheckable(True)
27
        self.pushButtonZoom.setAutoDefault(False)
27 28
        self.pushButtonZoom.setObjectName("pushButtonZoom")
28 29
        self.horizontalLayout.addWidget(self.pushButtonZoom)
29 30
        self.pushButtonAdd = QtWidgets.QPushButton(TrainingEditorDialog)
......
34 35
        self.pushButtonAdd.setSizePolicy(sizePolicy)
35 36
        self.pushButtonAdd.setMinimumSize(QtCore.QSize(64, 64))
36 37
        self.pushButtonAdd.setMaximumSize(QtCore.QSize(64, 64))
38
        self.pushButtonAdd.setAutoDefault(False)
37 39
        self.pushButtonAdd.setObjectName("pushButtonAdd")
38 40
        self.horizontalLayout.addWidget(self.pushButtonAdd)
39 41
        self.pushButtonDelete = QtWidgets.QPushButton(TrainingEditorDialog)
......
44 46
        self.pushButtonDelete.setSizePolicy(sizePolicy)
45 47
        self.pushButtonDelete.setMinimumSize(QtCore.QSize(64, 64))
46 48
        self.pushButtonDelete.setMaximumSize(QtCore.QSize(64, 64))
49
        self.pushButtonDelete.setAutoDefault(False)
47 50
        self.pushButtonDelete.setObjectName("pushButtonDelete")
48 51
        self.horizontalLayout.addWidget(self.pushButtonDelete)
49 52
        self.pushButtonMerge = QtWidgets.QPushButton(TrainingEditorDialog)
......
54 57
        self.pushButtonMerge.setSizePolicy(sizePolicy)
55 58
        self.pushButtonMerge.setMinimumSize(QtCore.QSize(64, 64))
56 59
        self.pushButtonMerge.setMaximumSize(QtCore.QSize(64, 64))
60
        self.pushButtonMerge.setAutoDefault(False)
57 61
        self.pushButtonMerge.setObjectName("pushButtonMerge")
58 62
        self.horizontalLayout.addWidget(self.pushButtonMerge)
59 63
        self.pushButtonSplite = QtWidgets.QPushButton(TrainingEditorDialog)
......
64 68
        self.pushButtonSplite.setSizePolicy(sizePolicy)
65 69
        self.pushButtonSplite.setMinimumSize(QtCore.QSize(64, 64))
66 70
        self.pushButtonSplite.setMaximumSize(QtCore.QSize(64, 64))
71
        self.pushButtonSplite.setAutoDefault(False)
67 72
        self.pushButtonSplite.setObjectName("pushButtonSplite")
68 73
        self.horizontalLayout.addWidget(self.pushButtonSplite)
69 74
        self.horizontalLayout_2.addLayout(self.horizontalLayout)
......
152 157
        spacerItem5 = QtWidgets.QSpacerItem(150, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
153 158
        self.horizontalLayout_6.addItem(spacerItem5)
154 159
        self.pushButtonChange = QtWidgets.QPushButton(self.leftSideWidget)
160
        self.pushButtonChange.setAutoDefault(False)
155 161
        self.pushButtonChange.setObjectName("pushButtonChange")
156 162
        self.horizontalLayout_6.addWidget(self.pushButtonChange)
157 163
        self.verticalLayout_7.addLayout(self.horizontalLayout_6)
......
169 175
        self.pushButtonSave.setSizePolicy(sizePolicy)
170 176
        self.pushButtonSave.setMinimumSize(QtCore.QSize(0, 32))
171 177
        self.pushButtonSave.setMaximumSize(QtCore.QSize(16777215, 32))
178
        self.pushButtonSave.setAutoDefault(False)
172 179
        self.pushButtonSave.setObjectName("pushButtonSave")
173 180
        self.horizontalLayout_5.addWidget(self.pushButtonSave)
174 181
        self.pushButtonCancel = QtWidgets.QPushButton(self.leftSideWidget)
......
179 186
        self.pushButtonCancel.setSizePolicy(sizePolicy)
180 187
        self.pushButtonCancel.setMinimumSize(QtCore.QSize(0, 32))
181 188
        self.pushButtonCancel.setMaximumSize(QtCore.QSize(16777215, 32))
189
        self.pushButtonCancel.setAutoDefault(False)
182 190
        self.pushButtonCancel.setObjectName("pushButtonCancel")
183 191
        self.horizontalLayout_5.addWidget(self.pushButtonCancel)
184 192
        self.verticalLayout_7.addLayout(self.horizontalLayout_5)
DTI_PID/DTI_PID/TrainingImageListDialog.py
56 56
                self.ui.tableWidgetList.setItem(row, 1, QTableWidgetItem(data))
57 57
                allDataList = docData.getTrainingFileList()
58 58
                for adata in allDataList:
59
                    boxName = data.replace('.png', '.box')
59
                    boxName = data.replace('.png', '.boxS')
60 60
                    if adata.find(boxName) is not -1:
61 61
                        appDocData = AppDocData.instance()
62 62
                        project = appDocData.getCurrentProject()
......
76 76
        @date       2018.10.17
77 77
    '''
78 78
    def makeTrainingDataClicked(self):
79
        appDocData = AppDocData.instance()
80
        project = appDocData.getCurrentProject()
81
        dataList = appDocData.getTrainingFileList()
82
        listHasBox = []
83
        listHasBoxImage = []
84
        for data in dataList:
85
            if data.find('.box') is not -1:
86
                hasBox = data.replace('.box', '.png')
87
                listHasBox.append(hasBox)
88
                drawingPath = os.path.join(project.getTrainingFilePath(), hasBox)
89
                drawing = Image.open(drawingPath)
90
                listHasBoxImage.append(drawing)
91
        
79
        from PIL import Image
80
        import math
81
        try:
82
            appDocData = AppDocData.instance()
83
            project = appDocData.getCurrentProject()
84
            dataList = appDocData.getTrainingFileList()
85
            listHasBox = []
86
            listHasBoxImage = []
87
            listBoxes = []
88
            for data in dataList:
89
                if data.find('.boxS') is not -1:
90
                    hasBox = data.replace('.boxS', '.png')
91
                    listHasBox.append(hasBox)
92
                    drawingPath = os.path.join(project.getTrainingFilePath(), hasBox)
93
                    drawing = Image.open(drawingPath)
94
                    listHasBoxImage.append(drawing)
95
                    boxPath = os.path.join(project.getTrainingFilePath(), data)
96
                    fw = open(boxPath, 'r', encoding='utf8')
97
                    boxContent = fw.read()
98
                    fw.close()
99
                    listBoxes.append(boxContent)
92 100
        
101
            areasNumber = len(listHasBoxImage)
102
            #print('total text areas : ' + str(areasNumber))
103
            maxW, maxH, sumW, sumH = 0, 0, 0, 0
104
            for imageArea in listHasBoxImage:
105
                areaW = imageArea.width
106
                areaH = imageArea.height
107
                sumW += areaW
108
                sumH += areaH
109
                if maxW < areaW:
110
                    maxW = areaW
111
                if maxH < areaH:
112
                    maxH = areaH
113
    
114
            #print('count : ' + str(areasNumber))
115
            #print('max width : ' + str(maxW) + ', max height : ' + str(maxH))
116
            argW = sumW / areasNumber
117
            argH = sumH / areasNumber
118
            #print('arg width : ' + str(argW) + ', arg height : ' + str(argH))
119
            totalArea = math.ceil(argW * argH * areasNumber)
120
            totalBaseWidth = math.ceil(math.sqrt(totalArea))
121
            #print('total area theory : ' + str(totalArea) + ', total width : ' + str(totalBaseWidth))
93 122

  
123
            for imageArea in listHasBoxImage:
124
                areaW = imageArea.width
125
                areaH = imageArea.height
126
                if totalBaseWidth < areaW:
127
                    totalBaseWidth = areaW + 1
128

  
129
            maxLineH, lineW, totalHeight = 0, 0, 0
130
            for imageArea in listHasBoxImage:
131
                areaW = imageArea.width
132
                areaH = imageArea.height
133
                if maxLineH < areaH:
134
                    maxLineH = areaH
135
                if lineW + areaW < totalBaseWidth:
136
                    lineW += areaW
137
                else:
138
                    lineW = areaW
139
                    totalHeight += maxLineH
140
            totalHeight += maxLineH
141
            #print('total area real : ' + str(totalBaseWidth * totalHeight) +', total width : ' + str(totalBaseWidth) + ', total height : ' + str(totalHeight) + ', ratio : ' + str(totalHeight / totalBaseWidth))
142

  
143
            trainingTextImg = Image.new("RGB", (totalBaseWidth, totalHeight), (256,256,256))
144
            seedHeight, seedWidth = trainingTextImg.height, trainingTextImg.width
145
            maxLineH, lineW, totalHeight, currentX, currentY = 0, 0, 0, 0, 0
146
            outBox = ""
147
            for index in range(0, len(listHasBoxImage)):
148
                areaW = listHasBoxImage[index].width
149
                areaH = listHasBoxImage[index].height
150
                
151
                boxes = listBoxes[index].split('\n')
152
            
153
                if maxLineH < areaH:    
154
                    maxLineH = areaH
155
                if lineW + areaW < totalBaseWidth:
156
                    lineW += areaW
157
                    trainingTextImg.paste(listHasBoxImage[index], (currentX, currentY, currentX + areaW, currentY + areaH))
158
                    for box in boxes:
159
                        if box == '': continue
160
                        boxComponent = box.split(' ')
161
                        boxComponent[1] = int(boxComponent[1]) + currentX
162
                        boxComponent[2] = seedHeight - currentY - areaH + int(boxComponent[2])
163
                        boxComponent[3] = int(boxComponent[3]) + currentX
164
                        boxComponent[4] = seedHeight - currentY - areaH + int(boxComponent[4])
165
                        outBox += boxComponent[0] + " " + str(boxComponent[1]) + " " + str(boxComponent[2]) + " " + str(boxComponent[3]) + " " + str(boxComponent[4]) + ' 0\n'
166
                    currentX = lineW
167

  
168
                else:
169
                    lineW = areaW
170
                    totalHeight += maxLineH
171
                    currentX = 0
172
                    currentY = totalHeight
173
                    trainingTextImg.paste(listHasBoxImage[index], (currentX, currentY, currentX + areaW, currentY + areaH))
174
                    for box in boxes:
175
                        if box == '': continue
176
                        boxComponent = box.split(' ')
177
                        boxComponent[1] = int(boxComponent[1]) + currentX
178
                        boxComponent[2] = seedHeight - currentY - areaH + int(boxComponent[2])
179
                        boxComponent[3] = int(boxComponent[3]) + currentX
180
                        boxComponent[4] = seedHeight - currentY - areaH + int(boxComponent[4])
181
                        outBox += boxComponent[0] + " " + str(boxComponent[1]) + " " + str(boxComponent[2]) + " " + str(boxComponent[3]) + " " + str(boxComponent[4]) + ' 0\n'
182
                    currentX = areaW
183

  
184
            trainingImgPath = os.path.join(project.getTrainingFilePath(), 'seed.seedF.exp0.tif')
185
            trainingBoxPath = os.path.join(project.getTrainingFilePath(), 'seed.seedF.exp0.box')
186
            trainingTextImg.save(trainingImgPath, compression='tiff_lzw')
187
            fw = open(trainingBoxPath, 'w') #파일 있으면 새로 만듬 예외 처리 안됨, 임시
188
            fw.write(outBox)
189
            fw.close()
190
 
191
        except Exception as ex:
192
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
94 193

  
95 194
    '''
96 195
        @brief      make Box data by button click
......
114 213
            drawingPath = os.path.join(project.getTrainingFilePath(), drawingName)
115 214
            drawing = Image.open(drawingPath)
116 215
            
117
            boundaryOcrData = pytesseract.image_to_boxes(drawing, config=DEFAULT_CONF, lang='seed+eng')
118

  
119
            boxName = drawingName.replace('.png', '.box')
216
            boxName = drawingName.replace('.png', '.boxS')
120 217

  
121 218
            docData = AppDocData.instance()
122 219
            dataList = docData.getTrainingFileList()
......
125 222
                if data.find(boxName) is not -1:
126 223
                    isBoxFile = True
127 224
            trainingBoxPath = os.path.join(project.getTrainingFilePath(), boxName)
225
            boundaryOcrData = None
128 226
            if not isBoxFile:
129
                fw = open(trainingBoxPath, 'w')
130
                fw.write(boundaryOcrData)
131
                fw.close()
227
                boundaryOcrData = pytesseract.image_to_boxes(drawing, config=DEFAULT_CONF, lang='seed+eng')
228

  
132 229
        except Exception as ex:
133 230
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
134 231

  
135 232
        try:
136
            dialog = QTrainingEditorDialog(self, drawingPath, trainingBoxPath)
233
            dialog = QTrainingEditorDialog(self, drawingPath, trainingBoxPath, boundaryOcrData)
137 234
            dialog.exec_()
235
            
236
            docData = AppDocData.instance()
237
            dataList = docData.getTrainingFileList()
238
            imgCount = 0
239
            for data in dataList:
240
                if data.find('.png') is not -1:
241
                    imgCount += 1            
242
            self.ui.tableWidgetList.setRowCount(imgCount)
243
        
244
            row = 0
245
            for data in dataList:
246
                if data.find('.png') is not -1:
247
                    self.ui.tableWidgetList.setItem(row, 0, QTableWidgetItem(str(row + 1)))
248
                    self.ui.tableWidgetList.setItem(row, 1, QTableWidgetItem(data))
249
                    allDataList = docData.getTrainingFileList()
250
                    for adata in allDataList:
251
                        boxName = data.replace('.png', '.boxS')
252
                        if adata.find(boxName) is not -1:
253
                            appDocData = AppDocData.instance()
254
                            project = appDocData.getCurrentProject()
255
                            boxPath = os.path.join(project.getTrainingFilePath(), boxName)
256
                            modifiedTime = time.ctime(os.path.getmtime(boxPath))
257
                            self.ui.tableWidgetList.setItem(row, 2, QTableWidgetItem(modifiedTime))
258
                    row += 1
259

  
138 260
        except Exception as ex:
139 261
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
140 262

  
......
155 277
        return
156 278

  
157 279
    '''
158
        @brief      add drawing to Selected by cell double click
280
        @brief      make Box data by cell double click
159 281
        @author     euisung
160 282
        @date       2018.09.28
161 283
    '''
162 284
    def listCellDoubleClicked(self, row, col):
163
        #print('row : ' + str(row) + ', col : ' + str(col))
164
        rowPosition = self.ui.tableWidgetSelected.rowCount()
165
        self.ui.tableWidgetSelected.setRowCount(rowPosition + 1)
166

  
167
        drawingName = self.ui.tableWidgetList.item(row, 1).text()
168
        #print(drawingName)
169
        self.trainingDataNumber = self.trainingDataNumber + 1
170
        self.ui.tableWidgetSelected.setItem(rowPosition, 0, QTableWidgetItem(str(self.trainingDataNumber)))
171
        self.ui.tableWidgetSelected.setItem(rowPosition, 1, QTableWidgetItem(drawingName))
172
        self.ui.tableWidgetSelected.setItem(rowPosition, 2, QTableWidgetItem('신규'))
173

  
174
        return
285
        self.pushButtonBoxClicked()
175 286

  
176 287

  
177 288
        
DTI_PID/DTI_PID/UI/TrainingEditor.ui
40 40
           <property name="checkable">
41 41
            <bool>true</bool>
42 42
           </property>
43
           <property name="autoDefault">
44
            <bool>false</bool>
45
           </property>
43 46
          </widget>
44 47
         </item>
45 48
         <item>
......
65 68
           <property name="text">
66 69
            <string>추가</string>
67 70
           </property>
71
           <property name="autoDefault">
72
            <bool>false</bool>
73
           </property>
68 74
          </widget>
69 75
         </item>
70 76
         <item>
......
90 96
           <property name="text">
91 97
            <string>삭제</string>
92 98
           </property>
99
           <property name="autoDefault">
100
            <bool>false</bool>
101
           </property>
93 102
          </widget>
94 103
         </item>
95 104
         <item>
......
115 124
           <property name="text">
116 125
            <string>병합</string>
117 126
           </property>
127
           <property name="autoDefault">
128
            <bool>false</bool>
129
           </property>
118 130
          </widget>
119 131
         </item>
120 132
         <item>
......
140 152
           <property name="text">
141 153
            <string>분할</string>
142 154
           </property>
155
           <property name="autoDefault">
156
            <bool>false</bool>
157
           </property>
143 158
          </widget>
144 159
         </item>
145 160
        </layout>
......
374 389
                <property name="text">
375 390
                 <string>문자 변경</string>
376 391
                </property>
392
                <property name="autoDefault">
393
                 <bool>false</bool>
394
                </property>
377 395
               </widget>
378 396
              </item>
379 397
             </layout>
......
435 453
                <property name="text">
436 454
                 <string>저장</string>
437 455
                </property>
456
                <property name="autoDefault">
457
                 <bool>false</bool>
458
                </property>
438 459
               </widget>
439 460
              </item>
440 461
              <item>
......
460 481
                <property name="text">
461 482
                 <string>닫기</string>
462 483
                </property>
484
                <property name="autoDefault">
485
                 <bool>false</bool>
486
                </property>
463 487
               </widget>
464 488
              </item>
465 489
             </layout>

내보내기 Unified diff

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