The constructor starts out by calling the parent's constructor
to initialize this instance's frame-nature. Then it stores the
name of the callback, and calls Section 15.7, “Adjuster.__createWidgets(): Create internal
widgets” to set up the contained
widgets.
# - - - A d j u s t e r . _ _ i n i t _ _
def __init__ ( self, parent, callback ):
"""Constructor for the Adjuster compound widget.
"""
#-- 1 --
# [ parent := parent with self added as a new Frame ]
Frame.__init__ ( self, parent )
To prevent callbacks during initialization, we temporarily set
the callback pointer to None.
#-- 2 --
self.__callback = None
Section 15.7, “Adjuster.__createWidgets(): Create internal
widgets” takes care not
only of widget creation, but also sets up the initial
colors.
#-- 3 --
# [ self := self with all contained widgets created and
# gridded ]
self.__createWidgets()
One more initialization remains. The ModelSelector widget, just created, selects one of the models initially. We
must now retrieve the current model from that widget and pass it
down to the ColorSliders widget so that it can
display the correct labels on the sliders. See
Section 17.2, “ModelSelector.getModel(): Return the current
model” and
Section 18.1, “ColorSliders.setModel(): Display a new color
model”.
#-- 4 --
# [ self.__colorSliders := self.__colorSliders displaying
# the color model currently selected in
# self.__modelSelector ]
model = self.__modelSelector.getModel()
self.__colorSliders.setModel ( model )
Now that everything is initialized, we can arm the callback mechanism.
#-- 5 --
self.__callback = callback