[sugar] Merging sugar-toolkit changes from tomeu repository

Marco Pesenti Gritti mpgritti
Fri Mar 28 16:52:47 EDT 2008


On Fri, Mar 28, 2008 at 8:13 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
>  >  +        self._label = gtk.AccelLabel('')
>  >  +        self._label.set_size_request(-1, style.zoom(style.GRID_CELL_SIZE) -
>  >  +                                         2 * self.get_border_width())
>  >
>  >  You are just changing this code but... bonus if you fix it up. We
>  >  should not use set_size_request here, if you change the font you are
>  >  screwed (it won't fit into the container anymore). Instead we should
>  >  use borders/padding/spacing and do the calculations to make our picky
>  >  designer happy in style (there are some examples of it there).
>
>  Heh, this gets delayed for U3 :P

You really really suck!

>  >  +    def set_tooltip(self, tooltip):
>  >  +        if self._tooltip != tooltip:
>  >  +            self._tooltip = tooltip
>  >  +            if tooltip and self.palette is None:
>  >  +                self.palette = Palette(tooltip)
>  >  +            elif self.palette:
>  >  +                self.palette.set_primary_text(tooltip)
>  >
>  >  Is the if at the top really necessary? I can't think of use cases
>  >  where we would be hitting it.
>  >  Also I'd replace the palette if you set_tooltip and a Palette already exist.
>
>  How so?

Are you trying to optimize the change tooltip use case there?

What about this logic:

* palette != None and tooltip == None -> replace the palette
* palette != None and tooltip != None -> replace primary text

(It would require to set tooltip to None on set_palette, but that make sense)

The semantic is going to be a bit unclear there in any case and we
should document it. But if I set_palette(fancy_dialog_like_palette)
and then set_tooltip, I'd expect a tooltip to appear, not the primary
text of my fancy palette to be changed.

Marco



More information about the Sugar-devel mailing list