This is done by
“xml_parse.XmlWidgetBuilder
”, a
subclass of
xml.sax.handler.ContentHandler
.
Basically, the steps involved are the following:
when the start of an 'object' element is reached, a
XMLWidgetObject
instance is created and
pushed onto a stack of the objects created: such object in turn
calls the appropriate ``xml builder'' function (got from the
“common.widgets_from_xml
” dictionary) that
creates the widget: this function is similar to the factory function
used to build the widget during an interactive session, see the code
for details and differences
when the end of an 'object' element is reached, the object at
the top of the stack is removed, and its widget (see the source of
XmlWidgetObject
) is laid out
when the end of a Property element is reached, the appropriate
setter function of the owner of the Property is called. This is the
default behaviour, suitable for simple properties. For more complex
properties, whose xml representation consists of more sub-elements,
each widget can define a particular handler: see for example
FontHandler
in
edit_windows.WindowBase