Phase 1 fixes: import cairo for the draw signal, Gdk version, hint wrap

- canvas.py imports cairo so the draw signal marshalling works
  (needs python3-gi-cairo on the server; installed 3.56.2-1)
- app.py: gi.require_version Gdk + hint label wraps in the palette pane
- README: python3-gi-cairo is a required package
This commit is contained in:
cnmcdee committed 2026-12-01 02:28:36 +00:00
1 parent cef7988a84
commit ff1cadbd80
3 files changed
+9 -1

No files matched your search

+4 -1
View File
@@ -19,12 +19,15 @@ and https://github.com/cnmcdee/lightgui_rust (Rust port).
- Python 3.10+
- PyGObject (`python3-gi`, GTK 3)
- pycairo (`python3-cairo`) — the XFrame widgets draw with Cairo
- `python3-gi-cairo` — the PyGObject/Cairo bridge; without it the
canvas `draw` signal fails with "Couldn't find foreign struct
converter for 'cairo.Context'"
- GTK 3.24
On Debian/Ubuntu/Parrot:
```
sudo apt install python3-gi python3-cairo gir1.2-gtk-3.0
sudo apt install python3-gi python3-cairo python3-gi-cairo gir1.2-gtk-3.0
```
## Run
+3
View File
@@ -9,6 +9,7 @@ on resize; there is no fixed 800x600 canvas.
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")
from gi.repository import Gdk, Gtk # noqa: E402
@@ -78,6 +79,8 @@ class Application:
hint = Gtk.Label(
label="Pick a widget, then click the canvas to place it.",
xalign=0)
hint.set_line_wrap(True)
hint.set_max_width_chars(32)
hint.set_margin_start(6)
hint.set_margin_top(4)
pane.pack_start(hint, False, False, 0)
+2
View File
@@ -29,6 +29,8 @@ import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")
import cairo # noqa: F401 (registers the cairo.Context converter with gi)
from gi.repository import Gdk, Gtk # noqa: E402
from lightgui.model import Project # noqa: E402