Windows compatibility
This commit is contained in:
@@ -9,6 +9,9 @@ from pathlib import Path
|
||||
from tkinter import filedialog, messagebox, ttk
|
||||
from typing import Any
|
||||
|
||||
from platform_utils import WindowsLabelError, validate_windows_labels
|
||||
|
||||
from .diagnostics import collect_diagnostics
|
||||
from .runner import ProcessRunner
|
||||
from .state import StateStore
|
||||
from .workflow import (
|
||||
@@ -42,6 +45,7 @@ class CopienatorApp(tk.Tk):
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.repository = repository.resolve()
|
||||
self.show_personal_steps = show_personal_steps
|
||||
self.steps = build_workflow(show_personal_steps)
|
||||
self.step_by_id = {step.id: step for step in self.steps}
|
||||
self.state_store = StateStore()
|
||||
@@ -93,6 +97,7 @@ class CopienatorApp(tk.Tk):
|
||||
path_entry.bind("<Return>", lambda _event: self._load_evaluation())
|
||||
ttk.Button(top, text="Parcourir…", command=self._browse_evaluation).grid(row=0, column=2, padx=6)
|
||||
ttk.Button(top, text="Charger", command=self._load_evaluation).grid(row=0, column=3)
|
||||
ttk.Button(top, text="Diagnostic…", command=self._show_diagnostics).grid(row=0, column=4, 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(
|
||||
@@ -194,6 +199,47 @@ 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 _show_diagnostics(self) -> None:
|
||||
checks = collect_diagnostics(
|
||||
self.show_personal_steps, self.api_key_var.get(), self.evaluation
|
||||
)
|
||||
dialog = tk.Toplevel(self)
|
||||
dialog.title("Diagnostic Copienator")
|
||||
dialog.geometry("760x480")
|
||||
dialog.transient(self)
|
||||
dialog.columnconfigure(0, weight=1)
|
||||
dialog.rowconfigure(1, weight=1)
|
||||
|
||||
required_missing = sum(1 for check in checks if check.required and not check.ok)
|
||||
summary = (
|
||||
"Tous les prérequis obligatoires sont disponibles."
|
||||
if required_missing == 0
|
||||
else f"{required_missing} prérequis obligatoire(s) manquant(s)."
|
||||
)
|
||||
ttk.Label(dialog, text=summary, padding=10, font=("TkDefaultFont", 11, "bold")).grid(
|
||||
row=0, column=0, sticky="w"
|
||||
)
|
||||
|
||||
tree = ttk.Treeview(dialog, columns=("state", "need", "detail"), show="headings")
|
||||
tree.heading("state", text="État")
|
||||
tree.heading("need", text="Niveau")
|
||||
tree.heading("detail", text="Composant et détail")
|
||||
tree.column("state", width=85, anchor="center")
|
||||
tree.column("need", width=100, anchor="center")
|
||||
tree.column("detail", width=530)
|
||||
for check in checks:
|
||||
tree.insert(
|
||||
"",
|
||||
"end",
|
||||
values=(
|
||||
"OK" if check.ok else "Manquant",
|
||||
"Obligatoire" if check.required else "Optionnel",
|
||||
f"{check.name} — {check.detail}",
|
||||
),
|
||||
)
|
||||
tree.grid(row=1, column=0, sticky="nsew", padx=10)
|
||||
ttk.Button(dialog, text="Fermer", command=dialog.destroy).grid(row=2, column=0, pady=10)
|
||||
|
||||
def _browse_evaluation(self) -> None:
|
||||
selected = filedialog.askdirectory(initialdir=self.evaluation_var.get() or self.repository)
|
||||
if selected:
|
||||
@@ -482,6 +528,19 @@ class CopienatorApp(tk.Tk):
|
||||
if step.is_manual:
|
||||
self._mark_step("success")
|
||||
return
|
||||
if os.name == "nt" and step.id != "statement":
|
||||
labels_path = evaluation / "labels"
|
||||
if labels_path.is_file():
|
||||
labels = [
|
||||
line.strip()
|
||||
for line in labels_path.read_text(encoding="utf-8").splitlines()
|
||||
if line.strip()
|
||||
]
|
||||
try:
|
||||
validate_windows_labels(labels)
|
||||
except WindowsLabelError as exc:
|
||||
messagebox.showerror("Labels incompatibles avec Windows", str(exc))
|
||||
return
|
||||
if not self._validate_arguments():
|
||||
return
|
||||
missing = self._missing_requirements(step)
|
||||
|
||||
Reference in New Issue
Block a user