Re: Still having problems with Mx.Widget subclassing
From: Lionel Landwerlin <llandwerlin gmail com>
To: clutter-list gnome org
Subject: Re: Still having problems with Mx.Widget subclassing
Date: Sat, 09 Feb 2013 21:39:13 +0000
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.
Presumably because paint on the parent recalls the
do_paint function on the child. Am I doing this right? It's a
bit of guesswork trying to translate the C to Python when it
comes to GObject based stuff. Now to figure out how to
implement the allocate function. I'll take a look at the Mx
source again. Thanks again for the help.
I really can't help you with python.
P.S. I'm having some issues with gmail and the
mailing list (you may have noticed a few messages ago). It
seems to want to send directly to you rather than via the
mailing list when I hit reply. Are you using any trick to make
it play nice, or just reply all (as I suspect I should have)?
I'm using thunderbird, there is a reply-to-list button.
Ok, I was wrong, so you indeed need to override the
allocate function.
We do chain up on allocate, but Clutter check whether
the allocate vfunc has been changed. If that's the case,
it doesn't allocate children.
Also don't forget to chain up on paint/allocate.
Regards,
-
Lionel
On 09/02/13 16:10, Nox Deleo wrote:
Forgot to mention it's the
LibraryView that's in the screenshot (although
it's happened with others). Got a bit of a cold
this weekend, so I'm forgetting all the important
things. Sorry.
Yeah, both in the code
and in the stylesheet.
I've done the same for
every child as well. It
works fine as a
ClutterActor subclass, but
I want to make use of Mx
styling among other
things.
Have you set a
size to your
Mx.Widget subclass
widget?
I don't think you
need to override
allocate, MxWidget
already calls its
parent allocate
method.
-
Lionel
On 09/02/13 14:56,
Nox Deleo wrote:
Hi,
I'm having
problems getting
Mx.Widget
subclasses to
display
properly. I had
a thread on this
a while back
which solved one
issue, but
showed another.
In my
Mx.Widget
subclasses, I'm
calling paint
for each child
in my widget now
when the parent
paint vfunc is
called. This is
painting things
(so far as I can
tell), but it
seems like the
children are
being painted
1x1 px in the
top left corner,
despite me
setting their
sizes. Do I need
to override
allocate for the
children as well
as paint, or is
there some other
issue here?
I've attached
a screenshot
showing the
issue. There is
an MxEntry and
an MxScrollview
in there
containing a
bunch of other
widgets.