Files
gniza4linux/tui/__main__.py
shuki 01cbe70c5d Fix install: copy tui/ package and install Python deps
- Install script now copies tui/ directory to install location
- Installs textual and textual-serve via pip after file copy
- __main__.py uses GNIZA_DIR env var for correct path resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 00:58:58 +02:00

29 lines
807 B
Python

import os
import sys
from pathlib import Path
from tui.app import GnizaApp
# Use GNIZA_DIR from env (set by bin/gniza), fall back to parent of tui/
_ROOT = os.environ.get("GNIZA_DIR", str(Path(__file__).resolve().parent.parent))
def main():
if "--web" in sys.argv:
from textual_serve.server import Server
port = 8080
for i, arg in enumerate(sys.argv):
if arg == "--port" and i + 1 < len(sys.argv):
port = int(sys.argv[i + 1])
os.environ["PYTHONPATH"] = f"{_ROOT}:{os.environ.get('PYTHONPATH', '')}"
os.environ["GNIZA_DIR"] = _ROOT
server = Server("python3 -m tui", host="0.0.0.0", port=port, title="gniza")
server.serve()
else:
app = GnizaApp()
app.run()
if __name__ == "__main__":
main()