Re: Still having problems with Mx.Widget subclassing



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);
        }
    }




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