Skip to content

info: Show which type/object callables are bound to

Benjamin Berg requested to merge benzea/vfunc-bound-descr into master
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

print(Gtk.Window.do_get_preferred_width)
print(Gtk.Widget.do_get_preferred_width)
w = Gtk.Window()
print(super(Gtk.Window, w))
print(super(Gtk.Window, w).do_get_preferred_width)
Gtk.Window.do_get_preferred_width(w)

With patch prints:

gi.VFuncInfo(get_preferred_width, bound=<GType GtkWindow (94666225146464)>)
gi.VFuncInfo(get_preferred_width, bound=<GType GtkWidget (94666225176160)>)
<super: <class 'Window'>, <Window object>>
gi.VFuncInfo(get_preferred_width, bound=<GType GtkWindow (94666225146464)>)

Without:

gi.VFuncInfo(get_preferred_width)
gi.VFuncInfo(get_preferred_width)
<super: <class 'Window'>, <Window object>>
gi.VFuncInfo(get_preferred_width)
Edited by Christoph Reiter

Merge request reports