Fix JBIG2 not updating progress bar

This commit is contained in:
James R. Barlow
2023-11-20 16:21:37 -08:00
parent 03669183d7
commit 8a73ed5d5a
2 changed files with 7 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ from __future__ import annotations
import threading
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Callable, TypeVar
from typing import Any, Callable, TypeVar
from ocrmypdf._progressbar import NullProgressBar, ProgressBar
@@ -19,6 +19,10 @@ def _task_noop(*_args, **_kwargs):
return
def _task_finished_noop(_result: Any, pbar: ProgressBar):
pbar.update()
class Executor(ABC):
"""Abstract concurrent executor."""
@@ -66,7 +70,7 @@ class Executor(ABC):
if not worker_initializer:
worker_initializer = _task_noop
if not task_finished:
task_finished = _task_noop
task_finished = _task_finished_noop
if not task:
task = _task_noop

View File

@@ -376,7 +376,7 @@ def _produce_jbig2_images(
options.jbig2_threshold,
)
def jbig2_single_args(root, groups: dict[int, list[XrefExt]]):
def jbig2_single_args(root: Path, groups: dict[int, list[XrefExt]]):
for group, xref_exts in groups.items():
prefix = f'group{group:08d}'
# Second loop is to ensure multiple images per page are unpacked