[Sugar-devel] [DESIGN] Re: [PATCH] fix OLPC #10488 - Color chooser does not always work when giving color to selected text

Simon Schampijer simon at schampijer.de
Mon Dec 6 05:28:22 EST 2010


Hi Gonzalo,

so the issue is the following:

We do only set the color when the palette is popped down. This does 
break the following case:

- select text you want to change the color of
- open the color chooser and change the color
- do click anywhere in the canvas (not the selected text) and don't wait 
for the palette to popdown

---> The text is not selected anymore when the palette pops down, hence 
the new color will not be applied.

I think the reason why Benjamin decided to set the color when the 
palette is closed is that when you would emit a color change on each 
change in the selector using the sliders would end up in a lot of 
signaling. That is why color selectors either have a fixed set of colors 
the user can select from or the custom selector with sliders is a dialog 
(ok, cancel) and therefore it is known when the user has made his decision.

How to move forward now with this? We could make at list the selector 
field emit the change directly. For the "slidered color selector", I am 
not sure. All the ideas I had did have possible races. Maybe we can live 
with the overhead of signaling and just make send it updates? Other ideas?

Regards,
    Simon

On 12/02/2010 03:27 PM, Gonzalo Odiard wrote:
> Emit signal at color change
> ---
>   src/sugar/graphics/colorbutton.py |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/sugar/graphics/colorbutton.py b/src/sugar/graphics/colorbutton.py
> index 1fed96d..c36320a 100644
> --- a/src/sugar/graphics/colorbutton.py
> +++ b/src/sugar/graphics/colorbutton.py
> @@ -125,7 +125,7 @@ class _ColorButton(gtk.Button):
>           self._preview.fill_color = get_svg_color_string(self._color)
>           if self._palette:
>               self._palette.props.color = self._color
> -        self.notify('color')
> +        self.emit('color-set')
>
>       def get_color(self):
>           return self._color
> @@ -379,7 +379,7 @@ class _ColorPalette(Palette):
>               self._scales[self._GREEN].set_value(self._color.green / 65535.0)
>               self._scales[self._BLUE].set_value(self._color.blue / 65535.0)
>
> -        self.notify('color')
> +        self.emit('color-set')
>
>       def get_color(self):
>           return self._color



More information about the Sugar-devel mailing list