DS09 : Conflict resolution, and other

This commit is contained in:
2026-06-29 13:29:28 +02:00
parent 27c0dae20e
commit 121bd0714a
6 changed files with 377 additions and 65 deletions
+17 -7
View File
@@ -135,17 +135,23 @@ def worker_thread(base_dir, files_to_process, all_labels):
print(f"Buffering {img_path.name}...")
(pil_image, last_label_index) = \
prepare_image(str(img_path), bb_list, all_labels, nb_pages, last_label_index)
metadata = {
"copie": copie,
"part": copie_part,
"schema": json_schema,
"name": json_name
}
error_msg = None
image_queue.put((pil_image, json_path, metadata))
except Exception as e:
print(f"Error processing {img_path.name}: {e}")
pil_image = Image.open(str(img_path))
error_msg = str(e)
metadata = {
"copie": copie,
"part": copie_part,
"schema": json_schema,
"name": json_name,
"error": error_msg
}
image_queue.put((pil_image, json_path, metadata))
# Sentinel to indicate finished
image_queue.put((None, None, None))
@@ -271,6 +277,10 @@ class ImageViewer:
self.is_viewing = True
self.root.lift()
if metadata.get("error"):
msg = f"Error generating boxes for {json_path.name}:\n\n{metadata['error']}\n\nPlease press 'e' to fix the JSON file, then press Enter to retry."
messagebox.showerror("Processing Error", msg)
def on_enter(self, event):
if self.is_viewing:
print(f"Committing data for {self.current_json_path.name}...")