Hey thanks a lot for the Help Justin.
My first guess was that once the item enters the Tree, the tree takes
ownership of the item, and because that, the callback cant find the object
who started it, altought the item stills finds the light...
But then I noticed, that the color still changes from white to black, like
if it was reading only luminance, so the callback is still there, maybe
just the way it converts the rgb values to color the styleshet of the
QLabel is missing., maybe I just need to use the Parent option when
starting the cmds.attrColorSliderGrp() calling the treeWidgetItem as
parent? (I couldn't do it, try several objects as parents it couldnt find
anyone) , or maybe use QItemDelegate instead of a QTreeWidgetItem?
I dont know.. but I fix it, making my own scriptjob, that looks for the
atrribute color change and recoloring the qlabel inside the object, by
looking at its children (the qlabel for the color is the child with 2 as
index).
self.treeWidget.itemWidget(treeWidgetItem,
4).children()[2].setStyleSheet("QLabel { background-color : rgb(%s%%, %s%%,
%s%%);}" % (str(color[0]), str(color[1]), str(color[2])))
That made the trick, But i dont know if is the best aproach, or if
scriptjob, is good enough (need to test it), or I need to make my own
callback using the API.
Thanks!
On Friday, November 8, 2013 9:27:11 PM UTC-6, Justin Israel wrote:
>
> The TreeWidget custom item widget thing is a bit limited and the docs say
> it is only meant for static widgets. I'm not sure where the line is for
> what is ok and what isn't but I suppose that is an issue with a widget that
> needs to change color. When I tested it completely standalone from Maya,
> using a custom Color Pot type widget I threw together, I get the same
> problem. What you have to do is keep the color value in sync with the
> item's background color.
>
> https://gist.github.com/justinfx/7381181
>
> Now, even though this works standalone, from within Maya the palette seems
> to be preventing it from working. Its just gray and I am not sure why that
> is yet.
>
>
>
> On Sat, Nov 9, 2013 at 7:38 AM, Macbeth R. <[email protected]<javascript:>
> > wrote:
>
>> Hi, Im trying to make a list of lights, and Im using attrColorSliderGrp,
>> to control the Color attribute of the light, using Nathan Horn method to
>> use Maya Widget into Pyqt (http://nathanhorne.com/?p=381), the aproach
>> works fine when adding it to an QHBoxlayout, or any other container, but
>> when added to a QTreeWidgetItem with QtGui.QTreeWidget.setItemWidget(),
>> everything works except the color show in the button is always white, but
>> when clicked it shows the real color, and you can change it.
>>
>> (In the Image here, the same objects wich where added
>> to qtreewidgetitem appears white, and on the bottom part, they where
>> added to an horizontal layout and they show OK)
>> http://s12.postimg.org/kal4ffh4t/Screenshot_1.png
>>
>> I guess something is overriding it, any idea what?? or any other aproach
>> I can use to achieve this?
>> The main reason why I' m not using a regular button, to call a regular
>> colorEditor(or even pyqt color picker
>> ), an apply changes to the color attribute of the light, is because I
>> want IPR to be refreshing live when browsing trough the color palette,
>> before you press OK, can this be achieved trough the api?? or othe
>> suggestions??
>>
>> Thanks.
>>
>> Macbeth Rene
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/4a6387c9-b96a-44e4-8890-c651371b69a6%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f743a88d-a46c-4f3f-818c-d800d75db538%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.