Support for post annotation label reassignement.

This commit is contained in:
sebastien committed 2026-10-11 19:03:04 +02:00
1 parent 698ac4240c
commit 370f3252ef
10 files changed
+242 -36

No files matched your search

+22 -4
View File
@@ -30,6 +30,7 @@ from .scores import ScoreEditorPanel
from .notifications import notify_desktop
from .syncthing import SyncthingPanel
from .manual_resolution import ManualResolutionPanel
from .annotation_modifications import AnnotationModificationsPanel, annotation_mode_for_reader
from .recorrection import prepare_selection_file
from .refaire import SECTION as REFAIRE_SECTION
from .refaire import (
@@ -824,6 +825,7 @@ class CopienatorApp(tk.Tk):
"labels",
"plotting",
"manual_resolution",
"modify_annotations",
"giving_names",
"edit_scores",
"statement_persp",
@@ -888,6 +890,9 @@ class CopienatorApp(tk.Tk):
value = False # Deletion is a one-run choice, never a saved default.
if step.id == 'statement' and spec.name == 'restart':
value = False
if step.id == "modify_annotations" and spec.name == "annotation_dir" and spec.name not in values:
reader = self.state_store.step("read_annotations")
value = annotation_mode_for_reader(reader)
choices = spec.choices
if spec.name == "annotation_dir" and step.id in {"export", "import"}:
choices, value = self._annotation_directory_choices(step.id)
@@ -939,13 +944,20 @@ class CopienatorApp(tk.Tk):
self.edit_recorrection_button.grid(row=row, column=0, columnspan=2, sticky="w", pady=8)
row += 1
if step.id == "manual_resolution":
if step.id in {"manual_resolution", "modify_annotations"}:
def manual_evaluation():
target = self.arg_vars.get("target")
value = target.get().strip() if target else ""
return (self.repository / value).resolve() if value else self.evaluation
self.manual_panel = ManualResolutionPanel(self.form, manual_evaluation)
if step.id == "modify_annotations":
self.manual_panel = AnnotationModificationsPanel(
self.form, manual_evaluation,
lambda: self.arg_vars["annotation_dir"].get(),
)
self.arg_vars["annotation_dir"].trace_add("write", lambda *_: self.manual_panel.reload())
else:
self.manual_panel = ManualResolutionPanel(self.form, manual_evaluation)
self.manual_panel.grid(row=row, column=0, columnspan=2, sticky="nsew", pady=8)
if "target" in self.arg_vars:
self.arg_vars["target"].trace_add("write", lambda *_args: self.manual_panel.reload())
@@ -966,7 +978,7 @@ class CopienatorApp(tk.Tk):
attach_tooltip(extra_entry, step.extra_arguments_help)
row += 1
self.run_button.configure(text="Enregistrer la sélection" if step.id == "refaire_selection" else ("Marquer terminée" if step.is_manual else "Exécuter"))
self.run_button.configure(text="Make modifications" if step.id == "modify_annotations" else "Enregistrer la sélection" if step.id == "refaire_selection" else ("Marquer terminée" if step.is_manual else "Exécuter"))
if step.id == "personal_create":
self.run_button.configure(text="Marquer Réussie")
if step.id == "personal_read":
@@ -1953,7 +1965,7 @@ class CopienatorApp(tk.Tk):
self._append_console(f"Impossible de lancer la copie suivante : {exc}\n")
status, return_code = "failed", 1
self.pending_refaire_commands = []
if step_id == "refaire_merge" and status == "success":
if step_id in {"refaire_merge", "modify_annotations"} and status == "success":
for downstream in ("giving_names", "update_ods", "final_score", "personal_deploy", "personal_sent"):
entry = self.state_store.step(downstream)
if entry.get("status") in {"success", "detected", "skipped"}:
@@ -1995,6 +2007,12 @@ class CopienatorApp(tk.Tk):
"manual": False, "reason": reason,
})
self._append_console(f"Remplacer les barèmes par Gemini : ignorée — {reason}\n")
if step_id == "read_annotations" and status == "success":
reader = self.state_store.step(step_id)
mode = annotation_mode_for_reader(reader)
values = dict(self.state_store.step("modify_annotations").get("values", {}))
values["annotation_dir"] = mode
self.state_store.update_step("modify_annotations", values=values)
if step_id == "annotation" and status == "success":
generation_variant = self.state_store.step("annotation").get(
"last_run_variant"