29 |
29 |
self.ui.setupUi(self)
|
30 |
30 |
|
31 |
31 |
self.table = self.ui.tableWidgetSymbol
|
|
32 |
self.currentRow = 0
|
|
33 |
self.currentColumn = 0
|
32 |
34 |
|
33 |
35 |
## box dir setting
|
34 |
36 |
self.boxDir = AppDocData.instance().getCurrentProject().path + '/box/'
|
... | ... | |
51 |
53 |
self.ui.listWidgetDrawings.setCurrentRow(0)
|
52 |
54 |
|
53 |
55 |
self.table.cellDoubleClicked.connect(self.cellDoubleClickedEvent)
|
|
56 |
self.table.currentCellChanged.connect(self.currentCellChangedEvent)
|
54 |
57 |
|
|
58 |
'''
|
|
59 |
@brief current cell chage event
|
|
60 |
@author kyouho
|
|
61 |
@date 2018.10.01
|
|
62 |
'''
|
|
63 |
def currentCellChangedEvent(self, currentRow, currentColumn, previousRow, previousColumn):
|
|
64 |
currentItem = self.table.cellWidget(currentRow, currentColumn)
|
|
65 |
if currentItem is not None:
|
|
66 |
self.currentRow = currentRow
|
|
67 |
self.currentColumn = currentColumn
|
|
68 |
else:
|
|
69 |
self.currentRow = -1
|
|
70 |
self.currentColumn = -1
|
|
71 |
|
|
72 |
'''
|
|
73 |
@brief cell double click event
|
|
74 |
@author kyouho
|
|
75 |
@date 2018.10.01
|
|
76 |
'''
|
55 |
77 |
def cellDoubleClickedEvent(self, row, column):
|
56 |
78 |
cell = self.table.cellWidget(row,column)
|
57 |
79 |
if cell is not None:
|
... | ... | |
152 |
174 |
## to xml
|
153 |
175 |
self.toXml(recList, offset)
|
154 |
176 |
|
|
177 |
## table setting
|
155 |
178 |
self.tableSetting()
|
156 |
179 |
|
157 |
180 |
self.progress.setValue(self.progress.maximum())
|
158 |
|
|
159 |
181 |
|
160 |
182 |
'''
|
161 |
183 |
@brief find lines
|
... | ... | |
229 |
251 |
percent = percent + percentGage
|
230 |
252 |
self.progress.setValue(percent)
|
231 |
253 |
QApplication.processEvents()
|
232 |
|
|
233 |
|
|
234 |
254 |
|
235 |
255 |
'''
|
236 |
256 |
@brief get contours
|
... | ... | |
279 |
299 |
|
280 |
300 |
return recList
|
281 |
301 |
|
282 |
|
|
283 |
|
|
|
302 |
'''
|
|
303 |
@brief key press event
|
|
304 |
@author kyouho
|
|
305 |
@date 2018.10.01
|
|
306 |
'''
|
|
307 |
def keyPressEvent(self, event):
|
|
308 |
if event.key() == Qt.Key_Delete and self.currentRow != -1 and self.currentColumn != -1:
|
|
309 |
self.table.removeCellWidget(self.currentRow, self.currentColumn)
|
|
310 |
|
284 |
311 |
|
285 |
312 |
'''
|
286 |
313 |
@brief box to xml
|
... | ... | |
321 |
348 |
ElementTree(xml).write(self.boxDir + self.imageName + '.box')
|
322 |
349 |
|
323 |
350 |
'''
|
324 |
|
@brief text changed Event
|
|
351 |
@brief table setting
|
325 |
352 |
@author kyouho
|
326 |
353 |
@date 2018.09.18
|
327 |
354 |
'''
|
... | ... | |
352 |
379 |
|
353 |
380 |
cell = QLabel()
|
354 |
381 |
cell.setPixmap(boxImg)
|
|
382 |
cell.rect = [_x, _y, _width, _height]
|
355 |
383 |
self.table.setCellWidget(rowIndex, boxCount % columnCount, cell)
|
356 |
384 |
|
357 |
385 |
boxCount = boxCount + 1
|
... | ... | |
361 |
389 |
self.table.resizeRowsToContents()
|
362 |
390 |
|
363 |
391 |
'''
|
364 |
|
@brief save fluid codes to sqlite
|
|
392 |
@brief accept
|
365 |
393 |
@author kyouho
|
366 |
|
@date 2018.09.18
|
|
394 |
@date 2018.10.01
|
367 |
395 |
'''
|
368 |
396 |
def accept(self):
|
369 |
|
|
|
397 |
columnCount = 3
|
|
398 |
recList = []
|
|
399 |
for rowIndex in range(self.table.rowCount()):
|
|
400 |
for columnIndex in range(columnCount):
|
|
401 |
cell = self.table.cellWidget(rowIndex, columnIndex)
|
|
402 |
if cell is not None:
|
|
403 |
[x, y, w, h] = cell.rect
|
|
404 |
recList.append([x, y, x+w, y+h])
|
|
405 |
|
|
406 |
self.toXml(recList, (0, 0))
|
|
407 |
|
370 |
408 |
QDialog.accept(self)
|
371 |
409 |
|
372 |
410 |
'''
|