When no margin detected, reserve a bit more space for comments
This commit is contained in:
1 parent
e7094d850e
commit
78a7b7679c
17 files changed
+357
-28
No files matched your search
@@ -7,7 +7,6 @@ import json
|
||||
import os
|
||||
import signal
|
||||
import shlex
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
@@ -20,6 +19,7 @@ from google.genai import types
|
||||
from copienator import configuration as config
|
||||
from copienator.commands import grouping
|
||||
from copienator.answer_origins import save_origins
|
||||
from copienator.annotation_layout import copy_answer_pdf, move_answer_pdf
|
||||
from copienator import prompting
|
||||
from copienator.gemini_config import fresh_seed, thinking_config
|
||||
from copienator import configuration as settings
|
||||
@@ -427,10 +427,10 @@ def handle_label_errors(pid, label, res, pdf_path):
|
||||
tprint(f"\t\tCopie{pid} : moving wrong {label} to {new_label}.")
|
||||
|
||||
# Copie vers _new, puis renommage de l'original vers _old
|
||||
shutil.copy(str(pdf_path), str(new_pdf_path))
|
||||
copy_answer_pdf(pdf_path, new_pdf_path)
|
||||
old_pdf_path = pdf_path.with_name(f"{label}_old.pdf")
|
||||
if pdf_path != old_pdf_path:
|
||||
shutil.move(str(pdf_path), str(old_pdf_path))
|
||||
move_answer_pdf(pdf_path, old_pdf_path)
|
||||
|
||||
idx = reserve_next_group_idx(new_label)
|
||||
height = grouping.get_pdf_height(str(new_pdf_path))
|
||||
@@ -464,7 +464,7 @@ def handle_label_errors(pid, label, res, pdf_path):
|
||||
add_pdf_path = COPIES_DIR / f"Copie{pid}" / f"{add_label}_new.pdf"
|
||||
|
||||
if not base_add_pdf_path.exists() and not add_pdf_path.exists():
|
||||
shutil.copy(str(pdf_path), str(add_pdf_path))
|
||||
copy_answer_pdf(pdf_path, add_pdf_path)
|
||||
save_origins(INPUT_DIR, pid, add_label, add_pdf_path, [label])
|
||||
tprint(f"\t\tCopying Copie{pid} : {label} -> {add_label}")
|
||||
idx = reserve_next_group_idx(add_label)
|
||||
@@ -578,7 +578,7 @@ def process_single_task(task_tuple, precomputed_response=None):
|
||||
if res.get("error") == "empty-answer":
|
||||
old_path = pdf_path.with_name(f"{label}_old.pdf")
|
||||
if pdf_path.exists() and pdf_path != old_path:
|
||||
shutil.move(str(pdf_path), str(old_path))
|
||||
move_answer_pdf(pdf_path, old_path)
|
||||
pdf_path = old_path
|
||||
current_suffix = "_old"
|
||||
|
||||
@@ -729,10 +729,10 @@ def resolve_delayed_moves():
|
||||
res["suffix"] = "_old" # Fixed typo: was suffixe
|
||||
resolved_any = True
|
||||
|
||||
shutil.copy(str(pdf_path), str(new_pdf_path))
|
||||
copy_answer_pdf(pdf_path, new_pdf_path)
|
||||
old_pdf_path = pdf_path.with_name(f"{label}_old.pdf")
|
||||
if pdf_path != old_pdf_path:
|
||||
shutil.move(str(pdf_path), str(old_pdf_path))
|
||||
move_answer_pdf(pdf_path, old_pdf_path)
|
||||
|
||||
idx = reserve_next_group_idx(target_label)
|
||||
height = grouping.get_pdf_height(str(new_pdf_path))
|
||||
@@ -751,7 +751,7 @@ def resolve_delayed_moves():
|
||||
res["error"] = res["error"].replace(f"(xx){target_label}", f"(->){target_label}")
|
||||
resolved_any = True
|
||||
|
||||
shutil.copy(str(pdf_path), str(add_pdf_path))
|
||||
copy_answer_pdf(pdf_path, add_pdf_path)
|
||||
save_origins(INPUT_DIR, pid, target_label, add_pdf_path, [label])
|
||||
idx = reserve_next_group_idx(target_label)
|
||||
height = grouping.get_pdf_height(str(add_pdf_path))
|
||||
|
||||
Reference in new issue
Block a user