Files
taninux/page_demo.py
T
karim e8d93e6b1d gui: native libadwaita-free UI backend + dark shell; packaging/iso updates
- gui/ui: native GTK4 widget vocabulary (.tn-*) behind the ui.* seam,
  default backend now native; style_apple.css design language
- shell: sidebar/topbar/content all #0f0f0f in dark (matches eww panels)
- new pages: wine, online_accounts
- packaging: tanin-icons (accent folder theme), tanin-calendar, gtklock,
  taninux-gtk3-theme, flatpak install handler
- iso/distro: profile + manifest tweaks (ISO binary not included)
2026-06-25 00:40:21 +02:00

62 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Lädt eine ECHTE TANINUX-Seite über die ui-Naht im native-Backend.
TANINUX_UI=native PYTHONPATH=src python page_demo.py defaultapps [--dark] [--shot=PATH]
Beweist die API-Gleichheit: derselbe Seiten-Code (gui/pages/<name>.py) rendert
unverändert sowohl mit Adw als auch mit den nativen Apple-Optik-Widgets — je
nach TANINUX_UI. Hier erzwingen wir native.
"""
from __future__ import annotations
import importlib
import os
import subprocess
import sys
os.environ.setdefault("TANINUX_UI", "native")
import gi # noqa: E402
gi.require_version("Gtk", "4.0")
from gi.repository import GLib, Gtk # noqa: E402
from taninux.gui import ui # noqa: E402
PAGE = next((a for a in sys.argv[1:] if not a.startswith("-")), "defaultapps")
DARK = "--dark" in sys.argv
SHOT = next((a for a in sys.argv if a.startswith("--shot=")), None)
SHOT = SHOT.split("=", 1)[1] if SHOT else None
def on_activate(app: Gtk.Application) -> None:
ui.ensure_css()
mod = importlib.import_module(f"taninux.gui.pages.{PAGE}")
win = Gtk.ApplicationWindow(application=app, title=f"{PAGE} · native")
win.set_default_size(720, 760)
ui.set_dark(win, DARK)
win.set_titlebar(Gtk.HeaderBar())
win.set_child(mod.build())
win.present()
if SHOT:
win.fullscreen()
def _capture() -> bool:
subprocess.run(["grim", SHOT], check=False)
app.quit()
return False
GLib.timeout_add(900, _capture)
def main() -> int:
app = Gtk.Application(application_id="ch.gabrielevarano.Taninux.PageDemo")
app.connect("activate", on_activate)
return app.run([])
if __name__ == "__main__":
raise SystemExit(main())