Various HTML improvements

This commit is contained in:
sebastien committed 2026-11-03 10:02:10 +01:00
1 parent fd943696fb
commit 8c1fa0af57
16 files changed
+403 -45

No files matched your search

+27 -2
View File
@@ -360,7 +360,12 @@ class CopienatorApp(tk.Tk):
top, text="Ouvrir l’énoncé", command=self._open_statement_pdf
)
self.open_statement_button.grid(row=0, column=5, padx=(6, 0))
ttk.Button(top, text="Finalisation web…", command=self._open_finalisation_web).grid(row=0, column=6, padx=(6, 0))
self.finalisation_web_button = ttk.Button(
top, text="Finalisation web…", command=self._open_finalisation_web, state="disabled"
)
self.finalisation_web_button.grid(row=0, column=6, padx=(6, 0))
attach_tooltip(self.finalisation_web_button,
"Disponible après une première lecture des annotations manuscrites (Bnot ou BGnot).")
ttk.Button(top, text="Diagnostic…", command=self._show_diagnostics).grid(row=0, column=7, padx=(6, 0))
ttk.Label(top, text="Clé Gemini").grid(row=1, column=0, sticky="w", padx=(0, 8), pady=(7, 0))
@@ -538,6 +543,19 @@ class CopienatorApp(tk.Tk):
status = ttk.Label(self, textvariable=self.info_var, anchor="w", relief="sunken", padding=(6, 3))
status.grid(row=3, column=0, sticky="ew")
def _has_finalisation_outputs(self) -> bool:
evaluation = self.state_store.evaluation
if evaluation is None:
return False
# Detect actual read results, including evaluations processed through the CLI.
# Review-sheet generation alone does not create info.json.
return any(
directory.is_dir() and directory.name[5:].isdigit()
and (directory / "score.json").is_file() and (directory / "info.json").is_file()
for mode in ("Bnot", "BGnot")
for directory in (evaluation / mode).glob("Copie*")
)
def _open_finalisation_web(self) -> None:
if self.web_session is not None or self.runner.running or self.active_step_id or self.batch_monitor.active:
messagebox.showinfo("Traitement en cours", "Terminez le traitement ou la surveillance en cours avant d’ouvrir la finalisation web.")
@@ -545,6 +563,9 @@ class CopienatorApp(tk.Tk):
if not self.evaluation:
messagebox.showerror("Évaluation absente", "Chargez d’abord une évaluation.")
return
if not self._has_finalisation_outputs():
messagebox.showinfo("Finalisation web", "Exécutez d’abord « Lire les annotations manuscrites ».")
return
self._save_current_form()
dialog = tk.Toplevel(self)
dialog.title("Finalisation web")
@@ -615,7 +636,7 @@ class CopienatorApp(tk.Tk):
def start():
try:
from copienator.finalisation_server import WebSession
self.web_session = WebSession(self.evaluation, mode.get())
self.web_session = WebSession(self.evaluation, mode.get(), repository=self.repository)
except Exception as exc:
messagebox.showerror("Finalisation web", str(exc), parent=dialog)
return
@@ -2417,6 +2438,10 @@ class CopienatorApp(tk.Tk):
def _update_controls(self) -> None:
running = bool(self.active_step_id) or self.runner.running
self.finalisation_web_button.configure(
state="normal" if not running and self.web_session is None
and not self.batch_monitor.active and self._has_finalisation_outputs() else "disabled"
)
if self.current_step and self.current_step.id == "personal_read":
for button in self.review_buttons:
button.configure(state="disabled" if running or not self.state_store.evaluation else "normal")