Re: Invisible GtkImage



On Fri, 2013-06-14 at 00:17 -0700, Andrew Potter wrote:
I suspect something weird is happening because you have the wrong
function signature. I can't find any reference to the basic widget
methods on the python gtk documentation website, but the C signature
is:

void                gtk_widget_get_preferred_height_for_width
                                                        (GtkWidget *widget,
                                                         gint width,
                                                         gint *minimum_height,
                                                         gint *natural_height);


So try:
def do_get_preferred_height_for_width(self, width, minimum_height,
natural_height):
  minimum_height = width / self._aspectRatio
  natural_height = width / self._aspectRatio

Hey Andrew. You're quite right. My override was implemented wrong.
However, I think the problem was not in the in parameters, but in the
out parameters. The input parameters I think were correct, but the
caller is expecting a two-tuple back out.

        get_preferred_height_for_width(self, width:int) -> 
                minimum_height:int, natural_height:int

When I fixed that, it doesn't core dump anymore. I just return the same
value for both fields.

I have three concerns. The first is that sometimes the incoming
allocation has some very strange width and height values in it, but are
usually valid the rest of the time. Sometimes I see values like
width of -408563232 and height of 32767.

My second concern is that when the assistant window is resized to be
made larger horizontally, the image grows, as it should, but the bottom
of the assistant page with the usual assistant buttons (e.g. Cancel,
Continue) get clipped some how.

Clipping: 
        <http://www.zimagez.com/zimage/screenshot-13-06-14-051057pm.php>

No clipping:
        <http://www.zimagez.com/zimage/screenshot-13-06-14-051249pm.php>

My final concern is I'm worried about the introspection system's error
control on handling bad return signatures the way it did here. Since
the introspection data knows that the method should have provided two
out parameters, you'd think it would have caught this more gracefully
with an exception than a core dump? But I guess that's probably nothing
you or I can do about that right now.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com


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