This method is called when the user changes the currently
selected color model. The internal text and background colors
do not change, but the ColorSliders widget must
change the labels and values shown on the three sliders for the
color model's three parameters.
Python's ability to pass classes as objects really
simplifies life here. We define an abstract class in
Section 7, “class ColorModel: Base class for color
models”, with concrete
subclasses for each color model. Then, when the user
selects a new color model, we can pass the actual Python
class to the ColorSliders
object, where it is needed to convert between parameter
values and colors. See also Section 18.1, “ColorSliders.setModel(): Display a new color
model”.
# - - - A d j u s t e r . _ _ m o d e l H a n d l e r
def __modelHandler ( self, model ):
"""Change the color model used in the color sliders.
[ model is a concrete subclass of ColorModel ->
self.__colorSliders := self.__colorSliders
displaying its current color using (model) ]
"""
self.__colorSliders.setModel ( model )