개정판 6850713e
issue #501: add progressbar
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
66 | 66 |
#drawUnknownItems = pyqtSignal(str, QObject) |
67 | 67 |
displayMessage = pyqtSignal(QListWidgetItem) |
68 | 68 |
updateProgress = pyqtSignal(int, str) |
69 |
updateBatchProgress = pyqtSignal(int, int) |
|
69 | 70 |
displayLog = pyqtSignal(MessageType, str) |
70 | 71 |
|
71 | 72 |
def __init__(self): |
... | ... | |
265 | 266 |
listWidget.addItem("Start recognition : " + mainRes) |
266 | 267 |
threadLock.acquire() |
267 | 268 |
|
269 |
worker.updateBatchProgress.emit(len(srcList), 1) |
|
270 |
|
|
268 | 271 |
if worker.isSymbolChecked: |
269 | 272 |
### calculate total count of symbol |
270 | 273 |
for targetItem in targetSymbolList: |
... | ... | |
274 | 277 |
maxProgressValue += 1 |
275 | 278 |
### up to here |
276 | 279 |
threadLock.release() |
277 |
|
|
280 |
|
|
278 | 281 |
if worker.isSymbolChecked: |
279 | 282 |
worker.displayTitle.emit('심볼 인식 중...') |
280 | 283 |
|
... | ... | |
304 | 307 |
pool.submit(Worker.removeDetectedSymbol, sym, appDocData.imgSrc) |
305 | 308 |
pool.shutdown(wait = True) |
306 | 309 |
|
310 |
worker.updateBatchProgress.emit(len(srcList), 1) |
|
311 |
|
|
307 | 312 |
## Remove Noise |
308 | 313 |
kernel1 = np.ones((2, 2), np.uint8) |
309 | 314 |
appDocData.imgSrc = cv2.dilate(appDocData.imgSrc, kernel1) |
... | ... | |
336 | 341 |
|
337 | 342 |
appDocData.imgName = os.path.splitext(os.path.basename(mainRes))[0] |
338 | 343 |
|
344 |
worker.updateBatchProgress.emit(len(srcList), 2) |
|
345 |
|
|
339 | 346 |
removedSymbolImgPath = os.path.join(project.getTempPath(), os.path.basename(mainRes)) |
340 | 347 |
cv2.imwrite(removedSymbolImgPath, appDocData.imgSrc) |
341 | 348 |
|
... | ... | |
363 | 370 |
Worker.recognizeLine(mainRes, listWidget, worker.graphicsView, worker, batch) |
364 | 371 |
|
365 | 372 |
drawUnknownItems(mainRes) |
366 |
|
|
373 |
|
|
374 |
worker.updateBatchProgress.emit(len(srcList), 1) |
|
367 | 375 |
except Exception as ex: |
368 | 376 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
369 | 377 |
worker.displayLog.emit(MessageType.Error, message) |
... | ... | |
1357 | 1365 |
elif image_path is not None: |
1358 | 1366 |
self.ui.labelImage.setText(image_path) |
1359 | 1367 |
|
1368 |
def updateBatchProgress(self, maxValue, weight): |
|
1369 |
''' |
|
1370 |
@brief update batch progressbar |
|
1371 |
@author euisung |
|
1372 |
@date 2018.11.28 |
|
1373 |
''' |
|
1374 |
self.ui.progressBarBatch.setMaximum(maxValue * 5) |
|
1375 |
self.ui.progressBarBatch.setValue(self.ui.progressBarBatch.value() + weight) |
|
1360 | 1376 |
''' |
1361 | 1377 |
@brief display title |
1362 | 1378 |
@author humkyung |
... | ... | |
1403 | 1419 |
#self.obj.drawUnknownItems.connect(self.drawUnknownItems) |
1404 | 1420 |
self.obj.displayMessage.connect(self.addListItem) |
1405 | 1421 |
self.obj.updateProgress.connect(self.updateProgress) |
1422 |
self.obj.updateBatchProgress.connect(self.updateBatchProgress) |
|
1406 | 1423 |
self.obj.displayLog.connect(App.mainWnd().addMessage) |
1407 | 1424 |
self.obj.displayTitle.connect(self.displayTitle) |
1408 | 1425 |
|
내보내기 Unified diff