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
|
#!/usr/bin/env python3
|
||||||
# FWS — fenêtre de bienvenue au premier démarrage (pendant post-install de la
|
# FWS — welcome window on first start. Buttons: system update, « Drivers &
|
||||||
# page récap de l'installateur). Boutons : mise à jour, codecs, VR, raccourcis,
|
# Hardware » (which also installs codecs, games and VR), Proton-GE, keyboard
|
||||||
# Proton-GE. GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ;
|
# 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.
|
# python-gobject est installé avec le bureau par le kickstart.
|
||||||
#
|
#
|
||||||
# Lancement : /etc/xdg/autostart (KDE/GNOME/XFCE) et exec des configs
|
# 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)
|
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
||||||
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
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 »
|
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante »
|
||||||
# ciblent cette classe.
|
# ciblent cette classe.
|
||||||
GLib.set_prgname("fws-hello")
|
GLib.set_prgname("fws-hello")
|
||||||
|
|
||||||
_FLAG = os.path.expanduser("~/.config/fws/hello-done")
|
_FLAG = os.path.expanduser("~/.config/fws/hello-done")
|
||||||
|
|
||||||
_CODECS = ("gst-plugins-base gst-plugins-good gst-plugins-bad "
|
# (label key, description key, command, in a terminal). Codecs and VR are
|
||||||
"gst-plugins-ugly gst-libav ffmpeg mpv")
|
# groups of « Drivers & Hardware »: one place to install them, not two.
|
||||||
|
|
||||||
# (libellé, description, commande, en_terminal)
|
|
||||||
_ACTIONS = [
|
_ACTIONS = [
|
||||||
("Mettre à jour le système",
|
("hello.update_label", "hello.update_description", "fws-update", True),
|
||||||
"pacman -Syu + nettoyage du cache",
|
("hello.drivers_label", "hello.drivers_description", "fws-drivers", False),
|
||||||
"fws-update", True),
|
("hello.proton_label", "hello.proton_description", "fws-proton-ge", 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),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
_TERMINALS = ["kitty", "konsole", "gnome-terminal", "xfce4-terminal", "xterm"]
|
_TERMINALS = ["kitty", "konsole", "gnome-terminal", "xfce4-terminal", "xterm"]
|
||||||
@@ -73,7 +65,7 @@ def _run(command, in_terminal):
|
|||||||
|
|
||||||
class HelloWindow(Gtk.Window):
|
class HelloWindow(Gtk.Window):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(title="Bienvenue sur FWS")
|
super().__init__(title=t("hello.window_title"))
|
||||||
self.set_default_size(460, -1)
|
self.set_default_size(460, -1)
|
||||||
self.set_position(Gtk.WindowPosition.CENTER)
|
self.set_position(Gtk.WindowPosition.CENTER)
|
||||||
self.set_border_width(18)
|
self.set_border_width(18)
|
||||||
@@ -87,11 +79,11 @@ class HelloWindow(Gtk.Window):
|
|||||||
self.add(box)
|
self.add(box)
|
||||||
|
|
||||||
title = Gtk.Label()
|
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)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
subtitle = Gtk.Label(
|
subtitle = Gtk.Label(label=t("hello.subtitle"))
|
||||||
label="Ton système est prêt. Quelques réglages utiles pour bien démarrer :")
|
|
||||||
subtitle.set_line_wrap(True)
|
subtitle.set_line_wrap(True)
|
||||||
subtitle.set_xalign(0)
|
subtitle.set_xalign(0)
|
||||||
box.pack_start(subtitle, False, False, 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.
|
# (Hyprland/i3) — les autres bureaux ont leurs propres réglages.
|
||||||
session = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
session = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
||||||
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE") or "i3" in session:
|
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE") or "i3" in session:
|
||||||
actions.append(("Voir les raccourcis clavier",
|
actions.append(("hello.keys_label", "hello.keys_description",
|
||||||
"aussi disponible à tout moment : Super+K",
|
|
||||||
"fws-keys", False))
|
"fws-keys", False))
|
||||||
|
|
||||||
for label, desc, command, in_term in actions:
|
for label, desc, command, in_term in actions:
|
||||||
button = Gtk.Button()
|
button = Gtk.Button()
|
||||||
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||||
lab = Gtk.Label()
|
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)
|
lab.set_xalign(0)
|
||||||
sub = Gtk.Label(label=desc)
|
sub = Gtk.Label(label=t(desc))
|
||||||
sub.set_xalign(0)
|
sub.set_xalign(0)
|
||||||
sub.get_style_context().add_class("dim-label")
|
sub.get_style_context().add_class("dim-label")
|
||||||
inner.pack_start(lab, False, False, 0)
|
inner.pack_start(lab, False, False, 0)
|
||||||
inner.pack_start(sub, False, False, 0)
|
inner.pack_start(sub, False, False, 0)
|
||||||
button.add(inner)
|
button.add(inner)
|
||||||
button.connect("clicked",
|
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)
|
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)
|
self._again.set_active(False)
|
||||||
box.pack_start(self._again, False, False, 6)
|
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())
|
close.connect("clicked", lambda _b: self.close())
|
||||||
box.pack_start(close, False, False, 0)
|
box.pack_start(close, False, False, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user