Next / Previous / Contents / TCC Help System / NM Tech homepage

18.1. ColorSliders.setModel(): Display a new color model

This method is called to changed the color model displayed in these sliders.

huey
# - - -   C o l o r S l i d e r s . s e t M o d e l

    def setModel ( self, model ):
        """Change the displayed color model.
        """

It is not necessary to display the name of the currently selected color model here. The user can look at the ModelSelector widget to find that out, or they can look at the labels displayed on the parameter sliders.

The primary work of this method, then, is to tell the ParamSlider widgets to change their labels to those of the parameters of the new models. Once they are relabeled, we call Section 18.2, “ColorSliders.setColor(): Change the displayed color” with the current color, which will tell the parameter sliders to redisplay that color using the newly selected model.

huey
        #-- 1 --
        self.__model  =  model

        #-- 2 --
        # [ self.__sliderList  :=  self.__sliderList with its
        #       contained widgets relabeled for model (model) ]
        for  paramx in range ( N_PARAMS ):
            self.__sliderList[paramx].setModel ( self.__model )

        #-- 3 --
        # [ self  :=  self displaying the parameters self.__color
        #             using model self.__model ]
        self.setColor ( self.__color )