Re: Invisible GtkImage



On Mon, 2013-06-24 at 13:56 -0700, Andrew Potter wrote:
Actually, it occurs to me that Kip is almost certainly going to want
to change the size request methods to:
     def do_get_preferred_width(self):
        pw = self.pb.get_width()
        return (0, pw)

    def do_get_preferred_height(self):
        ph = self.pb.get_height()
        return (0, ph)

    def do_get_preferred_height_for_width(self, width):
        ph = width / self.get_aspect_ratio()
        return (ph, ph)

Otherwise it won't scale down properly.

Hey Andrew,

So two questions now I have for you, if you don't mind. The first is a
problem with clipping, the same one I experienced a few days ago. Note
the assistant button widgets at the bottom of the assistant.

        Before resizing horizontally:
        <http://en.zimagez.com/zimage/screenshot-13-06-14-051249pm.php>

        After resizing horizontally, buttons clipped:
        <http://en.zimagez.com/zimage/screenshot-13-06-14-051057pm.php>

        Implementation:
        <http://pastebin.com/ynsQFTzU>

The second is just a request for clarification on the min() calculation
in your do_draw() override. I'd just like to better understand what that
calculation is attempting to do.

I also wanted to say thank you for having bared with me on this one.
It's amazing how sometimes what looks like a really simple problem
turns out to require a dozen minds and weeks of posts to really get to
the bottom of it and realize that sometimes these things are trickier
than they seem. Hopefully now if anyone else in the future wants to do
something similar with an image in Gtk+, they'll manage to find this
thread. Actually, it might even be worth adding on the FAQ.

Another thing I'd like to thank you for is how much cleaner this
implementation is than the mess I had before. It's much simpler and
doesn't require the client of ScalableImage to have to know or do as
much.

Take care,

-- 
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]