Fix Linux native window when uv venv hides system PyGObject

Isolated uv venvs cannot import apt-installed python3-gi, so native mode
always fell back to the browser. Append system dist-packages and verify
Gtk/WebKit typelibs before deciding native mode is unavailable; document
uv venv --system-site-packages as the durable install option.

Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-07-22 11:09:54 +00:00
parent d1e817f4ac
commit a70793f61a
3 changed files with 72 additions and 12 deletions

View File

@@ -28,8 +28,10 @@ Select with `--backend com|ooxml` (CLI) or the Backend dropdown (web UI).
interactive selection still works for config loading, but globbing finds no templates.
- NiceGUI defaults to a native window (`pywebview`). On Linux that needs **system**
GTK/WebKit packages (`python3-gi`, `gir1.2-gtk-3.0`, `gir1.2-webkit2-4.1` via apt) —
not installable with `uv`. On this headless VM native mode is unavailable; the app
falls back to the browser, or use `--no-browser` / `--browser`.
not installable with `uv`. Isolated uv venvs do not see apt `python3-gi` unless
created with `uv venv --system-site-packages` (or the app appends
`/usr/lib/python3/dist-packages`). On this headless/cloud VM native mode is often
unavailable; the app falls back to the browser, or use `--no-browser` / `--browser`.
### Environment
- Prefer **uv** for all installs (`uv` in `~/.local/bin`, on PATH via `~/.bashrc`).
@@ -39,6 +41,13 @@ Select with `--backend com|ooxml` (CLI) or the Backend dropdown (web UI).
uv sync
```
On a Linux desktop where you want the native window, prefer:
```bash
uv venv --system-site-packages
uv sync
```
- Run Python via the venv interpreter: `.venv/bin/python`.
- Optional: `XLSX_CLEAN_ROOT` remaps `D:\OpenCloud\...` paths from `file_data.csv`.
- Note: the `uv`-created `.venv` does not include `pip`; use `uv pip ...` / `uv sync`