Re: Still having problems with Mx.Widget subclassing



That did the trick. I had about half of MxStack's (sizeable) paint implementation redone in Python, but allocate_preferred_size is a lot shorter :). Mx.Widget.do_paint(self) and Mx.Widget.do_allocate(self, box, flags) worked for the chaining up. The 'super' method I usually use for some reason wasn't passing self properly. Maybe a mistake on my end, but everything is finally working as it should. Massive thanks to you both.


On 10 February 2013 10:42, Lionel Landwerlin <llandwerlin gmail com> wrote:
On 10/02/13 01:32, Simon Feltman wrote:



On Sat, Feb 9, 2013 at 1:39 PM, Lionel Landwerlin <llandwerlin gmail com> wrote:
On 09/02/13 20:39, Nox Deleo wrote:
Thanks for the clarification. I did wonder about chaining up before when I looked over the C code for other Mx widgets, but I couldn't get it to work.

super(Mx.Widget, self).paint()
RuntimeError: maximum recursion depth exceeded

Weird, it works in gjs. On the other hand I know nothing about python and the way it uses introspection.

Calling "paint" would just call the public clutter_actor_paint API which would in turn call your vfunc again. You might try:

def do_paint(self):
    Mx.Widget.do_paint(self)
 
I assume gjs would require something similar but prefixed with "vfunc" ?



This is what I have for gjs :

    vfunc_paint: function() {
        this.parent();
        let children = this.get_children();
        for (let i in children) {
            children[i].paint();
        }
    },

    vfunc_allocate: function(box, flags) {
        this.parent(box, flags);
        let children = this.get_children();
        for (let i in children) {
            children[i].allocate_preferred_size(flags);
        }
    }



_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]