mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
FIXUP: Fix progress percentages
This commit is contained in:
parent
4c7db48c59
commit
3e12aa3dfd
1 changed files with 4 additions and 5 deletions
|
@ -183,7 +183,6 @@ class IsolationProvider(ABC):
|
||||||
text = (
|
text = (
|
||||||
f"Converting page {page}/{n_pages} from pixels to {searchable}PDF"
|
f"Converting page {page}/{n_pages} from pixels to {searchable}PDF"
|
||||||
)
|
)
|
||||||
percentage += step
|
|
||||||
self.print_progress(document, False, text, percentage)
|
self.print_progress(document, False, text, percentage)
|
||||||
|
|
||||||
width = read_int(p.stdout)
|
width = read_int(p.stdout)
|
||||||
|
@ -199,8 +198,6 @@ class IsolationProvider(ABC):
|
||||||
num_pixels,
|
num_pixels,
|
||||||
)
|
)
|
||||||
|
|
||||||
percentage += step
|
|
||||||
|
|
||||||
page_pdf = self.pixels_to_pdf_page(
|
page_pdf = self.pixels_to_pdf_page(
|
||||||
untrusted_pixels,
|
untrusted_pixels,
|
||||||
width,
|
width,
|
||||||
|
@ -209,6 +206,8 @@ class IsolationProvider(ABC):
|
||||||
)
|
)
|
||||||
safe_doc.insert_pdf(page_pdf)
|
safe_doc.insert_pdf(page_pdf)
|
||||||
|
|
||||||
|
percentage += step
|
||||||
|
|
||||||
# Ensure nothing else is read after all bitmaps are obtained
|
# Ensure nothing else is read after all bitmaps are obtained
|
||||||
p.stdout.close()
|
p.stdout.close()
|
||||||
|
|
||||||
|
@ -218,8 +217,8 @@ class IsolationProvider(ABC):
|
||||||
os.replace(document.sanitized_output_filename, document.output_filename)
|
os.replace(document.sanitized_output_filename, document.output_filename)
|
||||||
|
|
||||||
# TODO handle leftover code input
|
# TODO handle leftover code input
|
||||||
text = "Converted document"
|
text = "Successfully converted document"
|
||||||
self.print_progress(document, False, text, percentage)
|
self.print_progress(document, False, text, 100)
|
||||||
|
|
||||||
def print_progress(
|
def print_progress(
|
||||||
self, document: Document, error: bool, text: str, percentage: float
|
self, document: Document, error: bool, text: str, percentage: float
|
||||||
|
|
Loading…
Reference in a new issue