[sugar] Merging sugar-toolkit changes from tomeu repository

Marco Pesenti Gritti mpgritti at gmail.com
Fri Mar 28 16:55:31 EDT 2008


On Fri, Mar 28, 2008 at 9:52 PM, Marco Pesenti Gritti
<mpgritti at gmail.com> wrote:
> On Fri, Mar 28, 2008 at 8:13 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
>  >  >  +    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.

Btw it seem like it would be fairly easy to factor out this logic to
toolbutton.setup_tooltip()

Marco


More information about the Sugar mailing list