From 3d6d2395b3d51bcb8c6a7365bbeae5a80b0a0f3e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 11 Aug 2026 18:55:52 -0400 Subject: [PATCH] [UPD] tui qemu: the plan shows each VM type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server-or-desktop choice only showed on the left, in the form. The table on the right, the one read before launching, said nothing about it: two visually identical plans could produce different VMs. The Status column, empty until now for a VM to create, therefore carries the type, and the totals line repeats it. An already defined VM keeps its collision message: it is not touched, showing a desktop there would suggest one is about to be installed on it. --- FR --- Le choix serveur ou bureau ne se voyait qu'à gauche, dans le formulaire. Le tableau de droite, celui qu'on relit avant de lancer, n'en disait rien : deux plans identiques à l'écran pouvaient produire des VM différentes. La colonne Statut, vide jusqu'ici pour une VM à créer, porte donc le type, et la ligne de totaux le rappelle. Une VM déjà définie garde son message de collision : elle n'est pas retouchée, lui afficher un bureau laisserait croire qu'on va lui en poser un. Assisted-by: Claude Opus 5 --- script/todo/qemu_deploy_form.py | 21 ++++++++++++++++++--- script/todo/todo_i18n.py | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/script/todo/qemu_deploy_form.py b/script/todo/qemu_deploy_form.py index 7f75bd8..83658f3 100644 --- a/script/todo/qemu_deploy_form.py +++ b/script/todo/qemu_deploy_form.py @@ -608,12 +608,25 @@ def run_deploy_form(ctx, run_app: bool = True): return "" return desktops[index - 1][0] + def _desktop_label(self): + """Libellé court du type de VM, pour le tableau et les totaux.""" + key = self._desktop() + if not key: + return t("server") + label = dict(desktops).get(key, key) + return f"🖥 {label}" + def _render_plan(self): table = self.query_one("#plan", DataTable) table.clear() + # Le type ne concerne QUE les VM réellement créées : une VM déjà + # définie n'est pas retouchée, lui afficher « GNOME » laisserait + # croire qu'on va lui poser un bureau. + kind = self._desktop_label() for r in self.rows: vm = r["vm"] icon = {"new": "", "exists": "⏭ ", "orphan": "❌ "}[r["state"]] + status = kind if r["state"] == "new" else f"{icon}{r['note']}" table.add_row( vm["name"], vm["distro"], @@ -622,7 +635,7 @@ def run_deploy_form(ctx, run_app: bool = True): str(vm["vcpus"]), f"{vm['ram']}Mo", f"{r['disk_gb']}G", - f"{icon}{r['note']}", + status, ) if not self.rows: # Rien de coché : un total à zéro n'apprend rien, on dit @@ -646,7 +659,7 @@ def run_deploy_form(ctx, run_app: bool = True): ) self.query_one("#totals", Static).update( f" {n} {t('VMs')} · {cpus} vCPU · {ram} Mo · ~{disk} G" - f"{warn}{dup_txt}" + f" · {self._desktop_label()}{warn}{dup_txt}" ) # -- réactions aux champs -------------------------------------- # @@ -655,7 +668,9 @@ def run_deploy_form(ctx, run_app: bool = True): self.arch = arches[event.radio_set.pressed_index] self._reload_catalog() elif event.radio_set.id == "f_type": - self._recompute() # le disque annonce inclut GNOME + # Recalcul : le disque annonce inclut le bureau, et la + # colonne Statut affiche le type de VM. + self._recompute() elif event.radio_set.id == "f_profile": index = event.radio_set.pressed_index self.profile = "custom" if index == 4 else str(index + 1) diff --git a/script/todo/todo_i18n.py b/script/todo/todo_i18n.py index 06289a0..4c5ffde 100644 --- a/script/todo/todo_i18n.py +++ b/script/todo/todo_i18n.py @@ -2035,6 +2035,10 @@ TRANSLATIONS = { "fr": "Graphique (serveur + bureau GNOME)", "en": "Graphical (server + GNOME desktop)", }, + "server": { + "fr": "serveur", + "en": "server", + }, "Graphical (server + desktop):": { "fr": "Graphique (serveur + bureau) :", "en": "Graphical (server + desktop):",