-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subclassing: what of it? #29
Comments
Subclassing isn't implemented (it gets lost on the Python -> C boundary) |
Okay. Well, I need it. Do you have any tips for where I might start looking in order to implement it? I would be loathe to have to switch to PyGObject and lose pypy support. |
It's not easy. There are two things missing: registering of gtypes for subclasses and adding a reference from the wrapper to the gobject and vice versa using toggle references [0]. No idea where to start... sorry. [0] https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-add-toggle-ref |
Okay. Well I'll have a bash at it and see if I get anywhere. |
I didn't get anywhere. My knowledge of gobject-related stuff just isn't good enough to do this work :/ |
I don't know how gobject stores it's data, but have built a class structure or two in my time Here's an example that takes some flat data: class name, methods and base classes names and then builds a set of classes from it. https://gist.github.com/stuaxo/397789c9c5272fee70fde0e6e73f62ef It builds the classes from the bottom up. I'm not sure if this example is helpful, but meant to write it here at least two years ago :) |
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.
The text was updated successfully, but these errors were encountered: