setNamedColor problem when using Pyside/Qt backend

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

setNamedColor problem when using Pyside/Qt backend

Brennan Williams
Just checking if anyone has come across this problem before.
I'm using the Qt/Pyside backend for my Traits/Chaco/MatplotLib
application and I'm getting lots of

QColor::setNamedColor: Unknown color name 'auto'

messages coming up. Not sure yet whether it is caused by a 3D matplotlib
scatter plot or by a Chaco line plot.

Regards

Brennan

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

Re: setNamedColor problem when using Pyside/Qt backend

Robert Kern
On Mon, Oct 1, 2012 at 11:58 PM, Brennan Williams
<[hidden email]> wrote:
> Just checking if anyone has come across this problem before.
> I'm using the Qt/Pyside backend for my Traits/Chaco/MatplotLib
> application and I'm getting lots of
>
> QColor::setNamedColor: Unknown color name 'auto'
>
> messages coming up. Not sure yet whether it is caused by a 3D matplotlib
> scatter plot or by a Chaco line plot.

Haven't seen it before.

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

Re: setNamedColor problem when using Pyside/Qt backend

Brennan Williams
On 2/10/2012 10:34 p.m., Robert Kern wrote:

> On Mon, Oct 1, 2012 at 11:58 PM, Brennan Williams
> <[hidden email]> wrote:
>> Just checking if anyone has come across this problem before.
>> I'm using the Qt/Pyside backend for my Traits/Chaco/MatplotLib
>> application and I'm getting lots of
>>
>> QColor::setNamedColor: Unknown color name 'auto'
>>
>> messages coming up. Not sure yet whether it is caused by a 3D matplotlib
>> scatter plot or by a Chaco line plot.
> Haven't seen it before.
>
Tracked it down a bit further.

from chaco.api import Plot,ArrayPlotData
from traits.api import Color
....
pdata=ArrayPlotData()
.....
p=Plot(pdata)
....
lineplot=p.plot((xname,yname),name=vname,color=vcolor,.....)

my vcolor is a Color

if I do

print 'vcolor=',vcolor

I get...

Pyside.QtGui.QColor.fromRGBF(0.000000,1.0000000,1.000000,1.000000)

which seems to causing a

QColor::setNamedColor: Unknown color name 'auto'

error or warning message. My app continues as per normal and the colours look correct.

Regards

Brennan



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

Re: setNamedColor problem when using Pyside/Qt backend

Brennan Williams
On 3/10/2012 12:12 p.m., Brennan Williams wrote:

> On 2/10/2012 10:34 p.m., Robert Kern wrote:
>> On Mon, Oct 1, 2012 at 11:58 PM, Brennan Williams
>> <[hidden email]> wrote:
>>> Just checking if anyone has come across this problem before.
>>> I'm using the Qt/Pyside backend for my Traits/Chaco/MatplotLib
>>> application and I'm getting lots of
>>>
>>> QColor::setNamedColor: Unknown color name 'auto'
>>>
>>> messages coming up. Not sure yet whether it is caused by a 3D matplotlib
>>> scatter plot or by a Chaco line plot.
>> Haven't seen it before.
>>
> Tracked it down a bit further.
>
> from chaco.api import Plot,ArrayPlotData
> from traits.api import Color
> ....
> pdata=ArrayPlotData()
> .....
> p=Plot(pdata)
> ....
> lineplot=p.plot((xname,yname),name=vname,color=vcolor,.....)
>
> my vcolor is a Color
>
> if I do
>
> print 'vcolor=',vcolor
>
> I get...
>
> Pyside.QtGui.QColor.fromRGBF(0.000000,1.0000000,1.000000,1.000000)
>
> which seems to causing a
>
> QColor::setNamedColor: Unknown color name 'auto'
>
> error or warning message. My app continues as per normal and the colours look correct.

Bit more info... the problem appears under Pyside but not under PyQt.

And, after looking through the docs a bit more, I think I should be
using ColorTrait rather than Color.

Just tried ColorTrait and the problem has now gone away. Just got to
test under wx.

Can anyone remind me what the difference is between Color and ColorTrait
and where each should be used?

Brennan

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

Re: setNamedColor problem when using Pyside/Qt backend

Jonathan March
On Tue, Oct 2, 2012 at 9:03 PM, Brennan Williams <[hidden email]> wrote:
On 3/10/2012 12:12 p.m., Brennan Williams wrote:
> On 2/10/2012 10:34 p.m., Robert Kern wrote:
>> On Mon, Oct 1, 2012 at 11:58 PM, Brennan Williams
>> <[hidden email]> wrote:
>>> Just checking if anyone has come across this problem before.
>>> I'm using the Qt/Pyside backend for my Traits/Chaco/MatplotLib
>>> application and I'm getting lots of
>>>
>>> QColor::setNamedColor: Unknown color name 'auto'
>>>
>>> messages coming up. Not sure yet whether it is caused by a 3D matplotlib
>>> scatter plot or by a Chaco line plot.
>> Haven't seen it before.
>>
> Tracked it down a bit further.
>
> from chaco.api import Plot,ArrayPlotData
> from traits.api import Color
> ....
> pdata=ArrayPlotData()
> .....
> p=Plot(pdata)
> ....
> lineplot=p.plot((xname,yname),name=vname,color=vcolor,.....)
>
> my vcolor is a Color
>
> if I do
>
> print 'vcolor=',vcolor
>
> I get...
>
> Pyside.QtGui.QColor.fromRGBF(0.000000,1.0000000,1.000000,1.000000)
>
> which seems to causing a
>
> QColor::setNamedColor: Unknown color name 'auto'
>
> error or warning message. My app continues as per normal and the colours look correct.

Bit more info... the problem appears under Pyside but not under PyQt.

And, after looking through the docs a bit more, I think I should be
using ColorTrait rather than Color.

Just tried ColorTrait and the problem has now gone away. Just got to
test under wx.

Can anyone remind me what the difference is between Color and ColorTrait
and where each should be used?

Brennan, just to copy you on some related notes that I made several years ago. hth:

Color chaos

The reading today is from the book of Bryce: "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).... Here is one of the biggest problems in my opinion of the way colors are treated in Traits. ... In the case of Color, it wants a value between 0 & 255. ... If you use the RGBColor trait instead, it wants values between 0 & 1. I'd love to fix this for good, but we have a lot of code which assumes one or the other which I would then break. The one solution I can recommend now, is to declare your colors using the names if possible: Color('red') or RGBColor('red') " (https://mail.enthought.com/pipermail/enthought-dev/2010-April/026088.html)

Adding to this from what I've just gleaned: It seems that TraitsUI editors mostly use 0..255, (Color trait, from the backend toolkit *ColorTrait*), whereas Enable/Chaco uses 0..1, which it calls (drumroll...) *ColorTrait*. 

So we have both substantive and naming confusion. (Not to mention that both "Color" and "RGBColor" are schemes for expressing RGB colors!)

And the fact that the available names of colors are different in Enable/Chaco and Traits, plus as soon as a user selects an arbitrary color from a color editor, they are out of name-land and into tuple-land.

But to the point: I need colors to flow between enable components which use 0..1, and TraitsUI widgets (e.g. a color in a ListStrEditor as applied by a ListStrAdapter, which uses 0..255). Of course I can do this manually, but perhaps this has already been automated somewhere?

[I did it manually.]

 


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