

def __componentValueChanged(self, componentWidget, reason):
    componentValue = componentWidget.getValue()
    componentValue = max(componentValue, 0)
    if (componentWidget.component in ('a', 'h', 's')):
        componentValue = min(componentValue, 1)
    newColor = self.__color.__class__(self.__color)
    if (componentWidget.component in ('r', 'g', 'b', 'a')):
        a = {
            'r': 0,
            'g': 1,
            'b': 2,
            'a': 3,
        }[componentWidget.component]
        newColor[a] = componentValue
    else:
        newColor = newColor.rgbToHSV()
        a = {
            'h': 0,
            's': 1,
            'v': 2,
        }[componentWidget.component]
        newColor[a] = componentValue
        newColor = newColor.hsvToRGB()
    self.__setColorInternal(newColor, reason)

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferUI/ColorChooser.py ColorChooser.__componentValueChanged/original