feat(i18n): translate fws-hello and drop its VR button
VR is now set up from « Pilotes et matériel », which fws-hello already offers.
This commit is contained in:
1 file changed
+24
-33
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
# FWS — fenêtre de bienvenue au premier démarrage (pendant post-install de la
|
||||
# page récap de l'installateur). Boutons : mise à jour, codecs, VR, raccourcis,
|
||||
# Proton-GE. GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ;
|
||||
# FWS — welcome window on first start. Buttons: system update, « Drivers &
|
||||
# Hardware » (which also installs codecs, games and VR), Proton-GE, keyboard
|
||||
# shortcuts. Texts come from system-translations.toml (hello.* keys).
|
||||
# GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ;
|
||||
# python-gobject est installé avec le bureau par le kickstart.
|
||||
#
|
||||
# Lancement : /etc/xdg/autostart (KDE/GNOME/XFCE) et exec des configs
|
||||
@@ -19,32 +20,23 @@ gi.require_version("Gtk", "3.0")
|
||||
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
||||
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
||||
|
||||
sys.path.insert(0, "/usr/local/lib/fws")
|
||||
from fws_i18n import catalog # noqa: E402
|
||||
|
||||
t = catalog("system").t
|
||||
|
||||
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante »
|
||||
# ciblent cette classe.
|
||||
GLib.set_prgname("fws-hello")
|
||||
|
||||
_FLAG = os.path.expanduser("~/.config/fws/hello-done")
|
||||
|
||||
_CODECS = ("gst-plugins-base gst-plugins-good gst-plugins-bad "
|
||||
"gst-plugins-ugly gst-libav ffmpeg mpv")
|
||||
|
||||
# (libellé, description, commande, en_terminal)
|
||||
# (label key, description key, command, in a terminal). Codecs and VR are
|
||||
# groups of « Drivers & Hardware »: one place to install them, not two.
|
||||
_ACTIONS = [
|
||||
("Mettre à jour le système",
|
||||
"pacman -Syu + nettoyage du cache",
|
||||
"fws-update", True),
|
||||
("Pilotes et matériel",
|
||||
"graphique, son, Bluetooth, luminosité, jeux, impression",
|
||||
"fws-drivers", False),
|
||||
("Installer les codecs multimédia",
|
||||
"lecture vidéo/audio (GStreamer, ffmpeg, mpv)",
|
||||
f"sudo pacman -S --needed {_CODECS}", True),
|
||||
("Proton-GE pour Steam",
|
||||
"meilleure compatibilité des jeux Windows",
|
||||
"fws-proton-ge", True),
|
||||
("Configurer la VR",
|
||||
"drivers casque : HTC Vive, Index, Quest…",
|
||||
"fws-vr-setup", True),
|
||||
("hello.update_label", "hello.update_description", "fws-update", True),
|
||||
("hello.drivers_label", "hello.drivers_description", "fws-drivers", False),
|
||||
("hello.proton_label", "hello.proton_description", "fws-proton-ge", True),
|
||||
]
|
||||
|
||||
_TERMINALS = ["kitty", "konsole", "gnome-terminal", "xfce4-terminal", "xterm"]
|
||||
@@ -73,7 +65,7 @@ def _run(command, in_terminal):
|
||||
|
||||
class HelloWindow(Gtk.Window):
|
||||
def __init__(self):
|
||||
super().__init__(title="Bienvenue sur FWS")
|
||||
super().__init__(title=t("hello.window_title"))
|
||||
self.set_default_size(460, -1)
|
||||
self.set_position(Gtk.WindowPosition.CENTER)
|
||||
self.set_border_width(18)
|
||||
@@ -87,11 +79,11 @@ class HelloWindow(Gtk.Window):
|
||||
self.add(box)
|
||||
|
||||
title = Gtk.Label()
|
||||
title.set_markup("<span size='x-large' weight='bold'>Bienvenue sur FWS !</span>")
|
||||
title.set_markup("<span size='x-large' weight='bold'>"
|
||||
f"{GLib.markup_escape_text(t('hello.title'))}</span>")
|
||||
box.pack_start(title, False, False, 0)
|
||||
|
||||
subtitle = Gtk.Label(
|
||||
label="Ton système est prêt. Quelques réglages utiles pour bien démarrer :")
|
||||
subtitle = Gtk.Label(label=t("hello.subtitle"))
|
||||
subtitle.set_line_wrap(True)
|
||||
subtitle.set_xalign(0)
|
||||
box.pack_start(subtitle, False, False, 0)
|
||||
@@ -101,31 +93,30 @@ class HelloWindow(Gtk.Window):
|
||||
# (Hyprland/i3) — les autres bureaux ont leurs propres réglages.
|
||||
session = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
||||
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE") or "i3" in session:
|
||||
actions.append(("Voir les raccourcis clavier",
|
||||
"aussi disponible à tout moment : Super+K",
|
||||
actions.append(("hello.keys_label", "hello.keys_description",
|
||||
"fws-keys", False))
|
||||
|
||||
for label, desc, command, in_term in actions:
|
||||
button = Gtk.Button()
|
||||
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||
lab = Gtk.Label()
|
||||
lab.set_markup(f"<b>{label}</b>")
|
||||
lab.set_markup(f"<b>{GLib.markup_escape_text(t(label))}</b>")
|
||||
lab.set_xalign(0)
|
||||
sub = Gtk.Label(label=desc)
|
||||
sub = Gtk.Label(label=t(desc))
|
||||
sub.set_xalign(0)
|
||||
sub.get_style_context().add_class("dim-label")
|
||||
inner.pack_start(lab, False, False, 0)
|
||||
inner.pack_start(sub, False, False, 0)
|
||||
button.add(inner)
|
||||
button.connect("clicked",
|
||||
lambda _b, c=command, t=in_term: _run(c, t))
|
||||
lambda _b, c=command, term=in_term: _run(c, term))
|
||||
box.pack_start(button, False, False, 0)
|
||||
|
||||
self._again = Gtk.CheckButton(label="Afficher cette fenêtre au prochain démarrage")
|
||||
self._again = Gtk.CheckButton(label=t("hello.show_again"))
|
||||
self._again.set_active(False)
|
||||
box.pack_start(self._again, False, False, 6)
|
||||
|
||||
close = Gtk.Button(label="Fermer")
|
||||
close = Gtk.Button(label=t("common.close"))
|
||||
close.connect("clicked", lambda _b: self.close())
|
||||
box.pack_start(close, False, False, 0)
|
||||
|
||||
|
||||
Reference in new issue
Block a user