Support Child Properties
Submitted by Dan Yeaw
Link to original bug (#784991)
Description
Bug 338098 added support for defining object properties using GObject.Property. In pygtk I was creating child properties using a dictionary, for example:
__gchild_properties__ = {
'weight': (GObject.TYPE_FLOAT,
'item weight',
'item weight',
0, # min
1, # max
.2, # default
GObject.ParamFlags.READWRITE
),
}
and then:
for index, (name, pspec) in enumerate(six.iteritems(DockPaned.__gchild_properties__)):
pspec = list(pspec)
pspec.insert(0, name)
Gtk.ContainerClass.install_child_property(DockPaned, index + 1, tuple(pspec))
Unfortunately with PyGObject this gives a TypeError: argument pspec: Expected GObject.ParamSpec, but got tuple
There needs to be a way to create child properties through install_child_property. What if we defined these properties using a new GObject.ChildProperty solution similar to what was added for other normal properties?
Edited by Christoph Reiter