' from gi.repository import Handy' does not load libhandy
I'm trying to make an UI with libhandy and Gtk.Builder, but this simple script
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Handy", "1")
from gi.repository import Gtk
from gi.repository import Handy
#windummy = Handy.Window()
#del windummy
builder = Gtk.Builder()
builder.add_from_file("simple.ui")
win = builder.get_object("window")
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()
simple.ui:
<interface>
<object class="HdyWindow" id="window">
<property name="can_focus">False</property>
<property name="visible">True</property>
<child>
<object class="GtkButton" id="button">
<property name="label" translatable="yes">Clicky</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
</object>
</interface>
Crashes with
Traceback (most recent call last):
File "./btest.py", line 20, in <module>
builder.add_from_file("simple.ui")
gi.repository.GLib.Error: gtk-builder-error-quark: simple.ui:3:1 Invalid object type 'HdyWindow' (6)
Calling Handy.Window() (or some other libhandy constructor) by uncommenting the line in the script causes libhandy to load and GtkBuilder works fine. Since using GtkBuilder with pure GTK interfaces works fine without calling any of the Gtk functions, this caused me quite a bit of head scratching.
Shouldn't "import gi.repository.Handy" also load the underlying dynamic library, i.e. libhandy? Apparently it does not.