Qubes: Fix progress in first stage of Qubes conversion

This commit is contained in:
Alex Pyrgiotis 2023-10-06 23:43:55 +03:00
parent 186ddd6b1e
commit edfba0c783
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -99,15 +99,15 @@ class Qubes(IsolationProvider):
n_pages = read_int(self.proc.stdout, timeout)
if n_pages == 0 or n_pages > errors.MAX_PAGES:
raise errors.MaxPagesException()
if ocr_lang:
percentage_per_page = 50.0 / n_pages
else:
percentage_per_page = 100.0 / n_pages
percentage_per_page = 50.0 / n_pages
timeout = calculate_timeout(size, n_pages)
sw = Stopwatch(timeout)
sw.start()
for page in range(1, n_pages + 1):
text = f"Converting page {page}/{n_pages} to pixels"
self.print_progress_trusted(document, False, text, percentage)
width = read_int(self.proc.stdout, timeout=sw.remaining)
height = read_int(self.proc.stdout, timeout=sw.remaining)
if not (1 <= width <= errors.MAX_PAGE_WIDTH):
@ -132,9 +132,6 @@ class Qubes(IsolationProvider):
percentage += percentage_per_page
text = f"Converting page {page}/{n_pages} to pixels"
self.print_progress_trusted(document, False, text, percentage)
# Ensure nothing else is read after all bitmaps are obtained
self.proc.stdout.close()