More OCR selected lines only

This commit is contained in:
niksedk 2022-09-26 21:01:45 +02:00
parent d6aa365cc1
commit d5a6aea3c2
3 changed files with 17 additions and 1 deletions

Binary file not shown.

View File

@ -5211,8 +5211,22 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
} }
else else
{ {
_abort = true; SetButtonsEnabledAfterOcrDone();
_mainOcrSelectedIndices = null; _mainOcrSelectedIndices = null;
if (_tesseractThreadRunner != null && (_ocrMethodIndex == _ocrMethodTesseract5 || _ocrMethodIndex == _ocrMethodTesseract302))
{
for (var i = 0; i < 100; i++)
{
System.Threading.Thread.Sleep(25);
_tesseractThreadRunner.CheckQueue();
if (_tesseractThreadRunner.Count == 0)
{
break;
}
}
}
return;
} }
} }
else else

View File

@ -80,6 +80,8 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Tesseract
ThreadPool.QueueUserWorkItem(DoOcr, job); ThreadPool.QueueUserWorkItem(DoOcr, job);
} }
public int Count => _jobQueue.Count;
public void CheckQueue() public void CheckQueue()
{ {
lock (QueueLock) lock (QueueLock)