Initial support for user general remarks

This commit is contained in:
sebastien committed 2026-10-28 13:51:59 +01:00
1 parent a38c1ff4b3
commit 2c9dc65640
16 files changed
+606 -20

No files matched your search

+12 -3
View File
@@ -2,6 +2,9 @@
from __future__ import annotations
import re
import shutil
from copienator import general_remarks
from copy import deepcopy
from hashlib import sha256
from pathlib import Path
@@ -154,7 +157,7 @@ def edited_bodies(directory: Path, meta: dict, instructions: list[ManualInstruct
def output_removals(directory: Path) -> tuple[str, ...]:
info = read_json(directory / "info.json") if (directory / "info.json").exists() else {}
return (STATE_FILE, "Concat.jpg", "Concat_F.jpg", "Concat_F.pdf", "touched.json", "answer_labels.json",
return (general_remarks.IMAGE_FILENAME, STATE_FILE, "Concat.jpg", "Concat_F.jpg", "Concat_F.pdf", "touched.json", "answer_labels.json",
*(f"{label}.jpg" for label, entry in info.items()
if Path(label).name == label))
@@ -181,7 +184,13 @@ def rebuild(root: Path, mode: str, directory: Path, staging: Path, meta: dict,
label for label, entry in info.items() if entry["not_empty"]
}
all_labels = utils.read_all_labels(root)
images, groups, checked_images = [], [], []
general = general_remarks.existing(directory)
images = [general] if general is not None else []
groups = [[general]] if general is not None else []
checked_images = []
if general is not None and directory != staging:
shutil.copy2(directory / general_remarks.IMAGE_FILENAME,
staging / general_remarks.IMAGE_FILENAME)
seen_contexts = set()
order = sorted(bodies, key=utils.natural_key)
for label in order:
@@ -215,7 +224,7 @@ def rebuild(root: Path, mode: str, directory: Path, staging: Path, meta: dict,
save_paginated_pdf(groups, staging / "Concat_F.pdf")
else:
stack([image for group in groups for image in group]).save(staging / "Concat_F.jpg")
save_checked_pdf(root, checked_images, all_labels, staging / "Concat_F.pdf")
save_checked_pdf(root, checked_images, all_labels, staging / "Concat_F.pdf", general=general)
def stage_baseline(root: Path, mode: str, output: Path, staging: Path,