-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Took a little time to get a minimal test case this time. Subclassing in the normal python way does not work. The objects get reinterpreted as being of the class you are subclassing.
No idea if there is a "proper" way of doing this at present (and it's merely undocumented), but it's getting in the way of one of my projects so I'd appreciate any advice about workarounds.
import pgi
pgi.install_as_gi()
from gi.repository import Gtk
class Failure(Gtk.ListBoxRow):
def __init__(self):
Gtk.ListBoxRow.__init__(self)
self.foo = "bar"
def cb(lb, row):
assert(row.foo == "bar")
f = Failure()
lb = Gtk.ListBox()
lb.insert(f,-1)
lb.connect('row-selected',cb)
lb.select_row(lb.get_row_at_index(0))