Files
taninux/scripts/demo/page_demo.py
T
karim 774809a579 chore(repo): stop tracking build artifacts; add README, license metadata, ruff config
Untrack iso/out/ (3.4 GB ISO), packaging/*/pkg/ trees, *.pkg.tar.zst and
tanin-icons/src/ (529 files) and ignore them going forward. Files stay on
disk. NOTE: history still carries ~13 GiB of old ISO blobs — needs a
git filter-repo pass (see README/report).

Also: first README.md, license + license-files in pyproject, minimal ruff
config, demo scripts moved to scripts/demo/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 21:21:28 +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())