Changes to Traits colors and ColorEditor in wx

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
I've added a new simple ColorEditor which is a dropdown of the W3C
colors. The old 'simple' style is still available as the 'custom' style.
The new 'simple' color editor should be much simpler and allow for
quicker simple color changes...

I noticed that often W3C and wx disagreed on the RGB values for certain
colors. Green, for example, is defined by wx as 00FF00 and by W3C as
008000. I've changed the implementation of the standard colors in Traits
to use W3C color definitions where there is a disagreement. I've also
added colors in the W3C standard 16 web colors which were missing, such
as 'lime'.

I didn't touch the Qt implementation, going on the assumption that it
was in better shape to begin with.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

Gael Varoquaux
Hey Brice,

On Thu, Apr 08, 2010 at 11:29:16AM -0500, bryce hendrix wrote:
> I've added a new simple ColorEditor which is a dropdown of the W3C
> colors. The old 'simple' style is still available as the 'custom' style.
> The new 'simple' color editor should be much simpler and allow for
> quicker simple color changes...

I know that we are being a pain, but it seems that with the latest
implementation, it is not possible to choose graphically an arbitrary
color in Mayavi anymore. IMHO this is a feature loss. Would it be
possible to add a 'custom' entry at the bottom of the dropdown list that
would launch the dialog that we had previously?

Thanks,

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
On 04/08/2010 12:13 PM, Gael Varoquaux wrote:

> Hey Brice,
>
> On Thu, Apr 08, 2010 at 11:29:16AM -0500, bryce hendrix wrote:
>    
>> I've added a new simple ColorEditor which is a dropdown of the W3C
>> colors. The old 'simple' style is still available as the 'custom' style.
>> The new 'simple' color editor should be much simpler and allow for
>> quicker simple color changes...
>>      
> I know that we are being a pain, but it seems that with the latest
> implementation, it is not possible to choose graphically an arbitrary
> color in Mayavi anymore. IMHO this is a feature loss. Would it be
> possible to add a 'custom' entry at the bottom of the dropdown list that
> would launch the dialog that we had previously?
>    

If you change the view style to 'custom' you should get the old method
back. I changed the 'simple' style to actually be simple... Let me know
if it doesn't work for you.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

Gael Varoquaux
On Thu, Apr 08, 2010 at 12:15:24PM -0500, bryce hendrix wrote:
> If you change the view style to 'custom' you should get the old method
> back. I changed the 'simple' style to actually be simple... Let me know
> if it doesn't work for you.

Well, ...

You know, the views in Mayavi are most often the default ones, because we
are dealing with generated TVTK objects, so I don't have much control on
the editor used.

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
On 04/08/2010 12:16 PM, Gael Varoquaux wrote:

> On Thu, Apr 08, 2010 at 12:15:24PM -0500, bryce hendrix wrote:
>    
>> If you change the view style to 'custom' you should get the old method
>> back. I changed the 'simple' style to actually be simple... Let me know
>> if it doesn't work for you.
>>      
> Well, ...
>
> You know, the views in Mayavi are most often the default ones, because we
> are dealing with generated TVTK objects, so I don't have much control on
> the editor used.
>
>    

I've got a couple conflicting requests, let me mull this one over during
lunch...

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by Gael Varoquaux
On 04/08/2010 12:16 PM, Gael Varoquaux wrote:

> On Thu, Apr 08, 2010 at 12:15:24PM -0500, bryce hendrix wrote:
>    
>> If you change the view style to 'custom' you should get the old method
>> back. I changed the 'simple' style to actually be simple... Let me know
>> if it doesn't work for you.
>>      
> Well, ...
>
> You know, the views in Mayavi are most often the default ones, because we
> are dealing with generated TVTK objects, so I don't have much control on
> the editor used.
>    

Okay, give it a try now. I'm not completely happy with the solution, but
it should be a stop-gap until I find a solution that works better.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

Gael Varoquaux
On Thu, Apr 08, 2010 at 01:00:28PM -0500, bryce hendrix wrote:
>> You know, the views in Mayavi are most often the default ones, because we
>> are dealing with generated TVTK objects, so I don't have much control on
>> the editor used.

>
> Okay, give it a try now. I'm not completely happy with the solution, but  
> it should be a stop-gap until I find a solution that works better.

Looks pretty good to me.

One small detail: on wxPython 2.8.10.1 (under Ubuntu), I am getting the
following when changing the color of the background of a Mayavi scene:

TraitError: The 'background' trait of a MayaviScene instance must be a
tuple of the form: (0.0 <= a floating point number <= 1.0, 0.0 <= a
floating point number <= 1.0, 0.0 <= a floating point number <= 1.0), but
a value of wx.Colour(0, 0, 0, 255) <class 'wx._gdi.Colour'> was
specified.

Thanks for your efforts,

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
On 04/08/2010 03:04 PM, Gael Varoquaux wrote:

> On Thu, Apr 08, 2010 at 01:00:28PM -0500, bryce hendrix wrote:
>    
>>> You know, the views in Mayavi are most often the default ones, because we
>>> are dealing with generated TVTK objects, so I don't have much control on
>>> the editor used.
>>>        
>    
>> Okay, give it a try now. I'm not completely happy with the solution, but
>> it should be a stop-gap until I find a solution that works better.
>>      
> Looks pretty good to me.
>
> One small detail: on wxPython 2.8.10.1 (under Ubuntu), I am getting the
> following when changing the color of the background of a Mayavi scene:
>
> TraitError: The 'background' trait of a MayaviScene instance must be a
> tuple of the form: (0.0<= a floating point number<= 1.0, 0.0<= a
> floating point number<= 1.0, 0.0<= a floating point number<= 1.0), but
> a value of wx.Colour(0, 0, 0, 255)<class 'wx._gdi.Colour'>  was
> specified.
>    

Arggggh! The whole Traits color scheme needs to be rewritten in my
opinion... There is a lot of conversion between tuples, strings and
Color instances, and multiple factories which do the conversions
differently (and often incorrectly). I'll try to track that one down,
thanks.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by Gael Varoquaux
On 4/8/2010 3:04 PM, Gael Varoquaux wrote:

> ...
> One small detail: on wxPython 2.8.10.1 (under Ubuntu), I am getting the
> following when changing the color of the background of a Mayavi scene:
>
> TraitError: The 'background' trait of a MayaviScene instance must be a
> tuple of the form: (0.0<= a floating point number<= 1.0, 0.0<= a
> floating point number<= 1.0, 0.0<= a floating point number<= 1.0), but
> a value of wx.Colour(0, 0, 0, 255)<class 'wx._gdi.Colour'>  was
> specified.
>    


Okay, I think its all fixed up.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

Gael Varoquaux
On Thu, Apr 08, 2010 at 10:43:59PM -0500, Bryce Hendrix wrote:
> On 4/8/2010 3:04 PM, Gael Varoquaux wrote:
>> ...
>> One small detail: on wxPython 2.8.10.1 (under Ubuntu), I am getting the
>> following when changing the color of the background of a Mayavi scene:

>> TraitError: The 'background' trait of a MayaviScene instance must be a
>> tuple of the form: (0.0<= a floating point number<= 1.0, 0.0<= a
>> floating point number<= 1.0, 0.0<= a floating point number<= 1.0), but
>> a value of wx.Colour(0, 0, 0, 255)<class 'wx._gdi.Colour'>  was
>> specified.

> Okay, I think its all fixed up.

I still get a failure (pretty much the same error) when selecting a
custom color.

Thanks a lot for you efforts, they are much appreciated.

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

fred-2
Hi all,

Please let me remind you the issue...

With version #25100, my Traits app looks like this:

http://ktools.free.fr/snapshot1.png

Background & Foreground fields in colors/font panel looks fine to me.

With version #25420, it looks like:

http://ktools.free.fr/snapshot2.png

ControlPanel is too wide, because of Traits Color editor.
And the bigger is the DisplayPanel (so the narrower the ControlPanel),
better it is.

With version #25460 (with Bruyce's last fixes), it looks like this:

http://ktools.free.fr/snapshot3.png

I would prefer only the little colored rectangle, and click on it to
edit the color, but that's ok with the Edit button, ControlPanel looks
good, it is not too wide.

But I get the following issue : the background color of the mayavi
window is really light (255, 255, 240).
If I edit it, the RGB values are (1, 1, 0), which is wrong.


TIA


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by Gael Varoquaux
On 04/09/2010 12:38 AM, Gael Varoquaux wrote:

> On Thu, Apr 08, 2010 at 10:43:59PM -0500, Bryce Hendrix wrote:
>    
>> On 4/8/2010 3:04 PM, Gael Varoquaux wrote:
>>      
>>> ...
>>> One small detail: on wxPython 2.8.10.1 (under Ubuntu), I am getting the
>>> following when changing the color of the background of a Mayavi scene:
>>>        
>    
>>> TraitError: The 'background' trait of a MayaviScene instance must be a
>>> tuple of the form: (0.0<= a floating point number<= 1.0, 0.0<= a
>>> floating point number<= 1.0, 0.0<= a floating point number<= 1.0), but
>>> a value of wx.Colour(0, 0, 0, 255)<class 'wx._gdi.Colour'>   was
>>> specified.
>>>        
>    
>> Okay, I think its all fixed up.
>>      
> I still get a failure (pretty much the same error) when selecting a
> custom color.
>
> Thanks a lot for you efforts, they are much appreciated.
>
>    

Well... It works for under Windows, though under Linux mayavi crashes (I
just updated to the Lucid beta). I'll try it on my Linux box @ home this
weekend.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by fred-2
On 04/09/2010 03:55 AM, fred wrote:

> Hi all,
>
> Please let me remind you the issue...
>
> With version #25100, my Traits app looks like this:
>
> http://ktools.free.fr/snapshot1.png
>
> Background&  Foreground fields in colors/font panel looks fine to me.
>
> With version #25420, it looks like:
>
> http://ktools.free.fr/snapshot2.png
>
> ControlPanel is too wide, because of Traits Color editor.
> And the bigger is the DisplayPanel (so the narrower the ControlPanel),
> better it is.
>
> With version #25460 (with Bruyce's last fixes), it looks like this:
>
> http://ktools.free.fr/snapshot3.png
>
> I would prefer only the little colored rectangle, and click on it to
> edit the color, but that's ok with the Edit button, ControlPanel looks
> good, it is not too wide.
>
> But I get the following issue : the background color of the mayavi
> window is really light (255, 255, 240).
> If I edit it, the RGB values are (1, 1, 0), which is wrong.
>
>    

Is the 'simple' editor acceptable, now that I added the custom color to it?

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

Gael Varoquaux
In reply to this post by bryce hendrix-2
On Fri, Apr 09, 2010 at 04:27:17PM -0500, bryce hendrix wrote:
> Well... It works for under Windows, though under Linux mayavi crashes (I  
> just updated to the Lucid beta).

Damn, not nice!

Can you give me a gdb stack trace please ?

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

fred-2
In reply to this post by bryce hendrix-2
Le 09/04/2010 23:29, bryce hendrix a écrit :

> Is the 'simple' editor acceptable, now that I added the custom color to it?
Sorry to say that, but it's too wide:

http://ktools.free.fr/snapshot4.png

And I still get the previous issue : the value (255, 255, 240) is not
passed to the custom color.

http://ktools.free.fr/snapshot5.png



Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by Gael Varoquaux
On 4/9/2010 4:30 PM, Gael Varoquaux wrote:

> On Fri, Apr 09, 2010 at 04:27:17PM -0500, bryce hendrix wrote:
>    
>> Well... It works for under Windows, though under Linux mayavi crashes (I
>> just updated to the Lucid beta).
>>      
> Damn, not nice!
>
> Can you give me a gdb stack trace please ?
>
>    

I'll try to remember to get one in the morning, but I suspect it is
something related to the nvidia drivers. I had to disable them in order
to get KDE to start because of missing symbols in a shared lib.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by fred-2
On 4/9/2010 5:45 PM, fred wrote:
> Le 09/04/2010 23:29, bryce hendrix a écrit :
>
>    
>> Is the 'simple' editor acceptable, now that I added the custom color to it?
>>      
> Sorry to say that, but it's too wide:
>
> http://ktools.free.fr/snapshot4.png
>    

Well, that should be easier to fix by recommending a max width. The
control is way wider than it needs to be by default...

> And I still get the previous issue : the value (255, 255, 240) is not
> passed to the custom color.
>
> http://ktools.free.fr/snapshot5.png
>    

I'm working on it...

Bryce
>
>
> Cheers,
>
>    

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
In reply to this post by fred-2
On 4/9/2010 5:45 PM, fred wrote:
> Le 09/04/2010 23:29, bryce hendrix a écrit :
>
>    
>> Is the 'simple' editor acceptable, now that I added the custom color to it?
>>      
> Sorry to say that, but it's too wide:
>
> http://ktools.free.fr/snapshot4.png
>    

Try it now, I reduced the size of the wx control, which made the demo
smaller, but it may not afftect your UI because I didn't explictly set
the max width of the control.

> And I still get the previous issue : the value (255, 255, 240) is not
> passed to the custom color.
>
> http://ktools.free.fr/snapshot5.png
>    

This should be fixed.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

fred-2
Le 12/04/2010 05:09, Bryce Hendrix a écrit :

>> And I still get the previous issue : the value (255, 255, 240) is not
>> passed to the custom color.
>>
>> http://ktools.free.fr/snapshot5.png
>
> This should be fixed.
Sorry, Bryce, but I don't think :-(

Please see the attached script.

The color trait is defined as red, but when you edit custom for
instance, it is still black.

TIA


Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

ColorEditor_demo.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changes to Traits colors and ColorEditor in wx

bryce hendrix-2
On 04/12/2010 03:08 AM, Fred wrote:

> Le 12/04/2010 05:09, Bryce Hendrix a écrit :
>
>>> And I still get the previous issue : the value (255, 255, 240) is not
>>> passed to the custom color.
>>>
>>> http://ktools.free.fr/snapshot5.png
>>
>> This should be fixed.
> Sorry, Bryce, but I don't think :-(
>
> Please see the attached script.
>
> The color trait is defined as red, but when you edit custom for
> instance, it is still black.
>

I think I'm missing a step here.

You fired up the demo, changed the simple editor to 'red', then changed
the color with the custom editor to something else, but the simple color
didn't change? In that case, it won't change the simple color unless the
new value is one of the options in the simple editor combo box. I
suppose I could set the combo box to the 'custom' value...

Or, do you mean that in the demo, with the simple editor you selected
red, then selected the custom value, changed the color to some value,
but the other 3 editors didn't get updated? That works for me with the
ColorEditor. The RGBColorEditor has some quirkiness to it though (color
gets set, text is wrong for the text style and the readonly style).

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
12