better faulty encoding detection

This commit is contained in:
sebastien committed 2026-09-29 08:03:47 +02:00
1 parent ec8e79bb1a
commit 2a4c5f4f7c
12 files changed
+299 -25

No files matched your search

+15 -5
View File
@@ -325,7 +325,7 @@ class CopienatorApp(tk.Tk):
top = ttk.Frame(self, padding=(10, 8))
top.grid(row=0, column=0, sticky="ew")
top.columnconfigure(5, weight=1)
top.columnconfigure(6, weight=1)
ttk.Button(top, text="Charger", command=self._load_evaluation).grid(
row=0, column=0, padx=(0, 8)
)
@@ -333,14 +333,19 @@ class CopienatorApp(tk.Tk):
self.evaluation_entry = ttk.Entry(top, textvariable=self.evaluation_var, width=42)
self.evaluation_entry.grid(row=0, column=2, sticky="w")
self.evaluation_entry.bind("<Return>", lambda _event: self._load_evaluation())
self.browse_evaluation_button = ttk.Button(
top, text="Parcourir…", command=self._browse_evaluation
)
self.browse_evaluation_button.grid(row=0, column=3, padx=(6, 0))
self.open_evaluation_button = ttk.Button(
top, text="Ouvrir le dossier", command=self._open_evaluation_folder
)
self.open_evaluation_button.grid(row=0, column=3, padx=(6, 0))
ttk.Button(top, text="Parcourir…", command=self._browse_evaluation).grid(
row=0, column=4, padx=6
self.open_evaluation_button.grid(row=0, column=4, padx=(12, 0))
self.open_statement_button = ttk.Button(
top, text="Ouvrir l’énoncé", command=self._open_statement_pdf
)
ttk.Button(top, text="Diagnostic…", command=self._show_diagnostics).grid(row=0, column=6, padx=(6, 0))
self.open_statement_button.grid(row=0, column=5, padx=(6, 0))
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))
ttk.Entry(top, textvariable=self.api_key_var, show="•", width=32).grid(
@@ -560,6 +565,11 @@ class CopienatorApp(tk.Tk):
def _open_evaluation_folder(self) -> None:
self._open_desktop_path(self.evaluation, "dossier d’évaluation")
def _open_statement_pdf(self) -> None:
evaluation = self.evaluation
statement = EvaluationWorkspace(evaluation).statement_pdf_file if evaluation else None
self._open_desktop_path(statement, "fichier enonce.pdf")
def _toggle_proxy(self) -> None:
self.proxy_entry.configure(state="normal" if self.use_proxy_var.get() else "disabled")
+13 -7
View File
@@ -4,12 +4,13 @@ import subprocess
import threading
from tkinter import ttk, messagebox
SERVICE = "syncthing@sebastien.service"
SERVICE = "syncthing.service"
SYSTEMCTL = ("systemctl", "--user", "--no-ask-password")
def service_status():
result = subprocess.run(
["systemctl", "show", SERVICE, "--property=ActiveState", "--value"],
[*SYSTEMCTL, "show", SERVICE, "--property=ActiveState", "--value"],
capture_output=True, text=True, timeout=10,
)
if result.returncode:
@@ -22,7 +23,7 @@ def control_service(action):
return "active"
command = "start" if action == "ensure" else action
result = subprocess.run(
["systemctl", "--no-ask-password", command, SERVICE],
[*SYSTEMCTL, command, SERVICE],
capture_output=True, text=True, timeout=60,
)
if result.returncode:
@@ -87,13 +88,18 @@ class SyncthingPanel(ttk.Frame):
self.start_button.configure(state="normal")
self.stop_button.configure(state="normal")
self.status.configure(text=f"{SERVICE} : {error or status}")
if error and action != "status":
self.pending_export = None
messagebox.showerror("Syncthing", error)
elif action == "ensure":
if action == "ensure":
callback, self.pending_export = self.pending_export, None
if error:
messagebox.showwarning(
"Syncthing",
f"Impossible de démarrer Syncthing : {error}\n\n"
"L’export va continuer.",
)
if callback:
callback()
elif error and action != "status":
messagebox.showerror("Syncthing", error)
elif self.pending_export:
self.request("ensure")
if self.winfo_exists():