Improve web finalisation navigation, caching and Anot support
This commit is contained in:
1 parent
5de70dbc0d
commit
b069805988
21 files changed
+339
-58
No files matched your search
+28
-15
@@ -365,7 +365,7 @@ class CopienatorApp(tk.Tk):
|
||||
)
|
||||
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).")
|
||||
"Disponible après génération Anot ou lecture des annotations manuscrites Bnot/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))
|
||||
@@ -552,7 +552,7 @@ class CopienatorApp(tk.Tk):
|
||||
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 mode in ("Bnot", "BGnot", "Anot")
|
||||
for directory in (evaluation / mode).glob("Copie*")
|
||||
)
|
||||
|
||||
@@ -564,7 +564,7 @@ class CopienatorApp(tk.Tk):
|
||||
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 ».")
|
||||
messagebox.showinfo("Finalisation web", "Générez d’abord les annotations Anot, ou lisez les annotations manuscrites Bnot/BGnot.")
|
||||
return
|
||||
self._save_current_form()
|
||||
dialog = tk.Toplevel(self)
|
||||
@@ -573,10 +573,17 @@ class CopienatorApp(tk.Tk):
|
||||
dialog.resizable(False, False)
|
||||
frame = ttk.Frame(dialog, padding=24)
|
||||
frame.pack(fill="both", expand=True)
|
||||
text = tk.StringVar(value="Choisissez le mode utilisé pour lire les annotations manuscrites.")
|
||||
text = tk.StringVar(value="Choisissez le dossier des copies générées ou relues.")
|
||||
ttk.Label(frame, textvariable=text, wraplength=500).pack(pady=(0, 12))
|
||||
mode = tk.StringVar(value=annotation_mode_for_reader(self.state_store.step("read_annotations")))
|
||||
choice = ttk.Combobox(frame, textvariable=mode, values=("BGnot", "Bnot"), state="readonly")
|
||||
preferred_mode = annotation_mode_for_reader(self.state_store.step("read_annotations"))
|
||||
ready_modes = [mode for mode in ANNOTATION_DIRECTORIES
|
||||
if any((d / "score.json").is_file() and (d / "info.json").is_file()
|
||||
for d in (self.evaluation / mode).glob("Copie*"))]
|
||||
annotation = self.state_store.step("annotation")
|
||||
if annotation.get("last_run_variant", annotation.get("variant")) == "simple" and "Anot" in ready_modes:
|
||||
preferred_mode = "Anot"
|
||||
mode = tk.StringVar(value=preferred_mode if preferred_mode in ready_modes else ready_modes[0])
|
||||
choice = ttk.Combobox(frame, textvariable=mode, values=ready_modes, state="readonly")
|
||||
choice.pack(fill="x", pady=8)
|
||||
url = tk.StringVar()
|
||||
link = ttk.Entry(frame, textvariable=url, state="readonly", width=65)
|
||||
@@ -597,15 +604,21 @@ class CopienatorApp(tk.Tk):
|
||||
reader = self.state_store.step("read_annotations")
|
||||
values = dict(reader.get("values", {}))
|
||||
values["update_score"] = True
|
||||
if data["dirty"] or session.service.job["status"] != "idle":
|
||||
self.state_store.invalidate_after(self._progression_ids("read_annotations"), "read_annotations")
|
||||
self.state_store.update_step("read_annotations", variant="standard" if session.service.mode == "Bnot" else "grouped")
|
||||
if data["dirty"] or session.service.job["status"] == "failed":
|
||||
self.state_store.update_step("read_annotations", status="stale", values=values)
|
||||
self.state_store.update_step("giving_names", status="stale")
|
||||
elif session.service.job["status"] == "success":
|
||||
self.state_store.update_step("read_annotations", status="success", values=values)
|
||||
self.state_store.update_step("giving_names", status="detected")
|
||||
if session.service.mode == "Anot":
|
||||
if data["dirty"] or session.service.job["status"] != "idle":
|
||||
self.state_store.invalidate_after(self._progression_ids("annotation"), "annotation")
|
||||
self.state_store.update_step("annotation", variant="simple", status="stale" if data["dirty"] else "success")
|
||||
self.state_store.update_step("giving_names", status="stale" if data["dirty"] else "detected")
|
||||
else:
|
||||
if data["dirty"] or session.service.job["status"] != "idle":
|
||||
self.state_store.invalidate_after(self._progression_ids("read_annotations"), "read_annotations")
|
||||
self.state_store.update_step("read_annotations", variant="standard" if session.service.mode == "Bnot" else "grouped")
|
||||
if data["dirty"] or session.service.job["status"] == "failed":
|
||||
self.state_store.update_step("read_annotations", status="stale", values=values)
|
||||
self.state_store.update_step("giving_names", status="stale")
|
||||
elif session.service.job["status"] == "success":
|
||||
self.state_store.update_step("read_annotations", status="success", values=values)
|
||||
self.state_store.update_step("giving_names", status="detected")
|
||||
self._populate_tree()
|
||||
self._render_step()
|
||||
self._update_controls()
|
||||
|
||||
Reference in new issue
Block a user