I have several helper functions used to define especial GObjects. These functions should be called during the class_init. I'm trying to define these objects directly from python. Is it possible to access the class struct during the class initialization in PyGObject?
For example:
from gi.repository import GObject
class Test (GObject):
...
foo = GObject.Property(type=str, default='bar')
# At this point is it possible to access the equivalent to
# klass in ns_test_class_init (NsTestClass *klass)?
...
def a_method (self):
...
Is it possible to access the class struct during the class initialization in PyGObject?
Not currently. GObject class init and instance init support will probably be added in the 3.15/16 releases in order to support GTK+ Composite Templates.
See: https://bugzilla.gnome.org/show_bug.cgi?id=701843 (which has patches for this).
As a side note, you should be able to do almost anything in pure Python using __init__() or even meta-classes which gives access to the Python class, unless of course your "helper functions" are written in C and require the GObject class struct.