+
+ if wname:
+ #print "Widget name=", wname
+ visited_components.add(wname)
+
+ # get corresponding 'gui' object
+ try:
+ attributes = screen[wname].skinAttributes = [ ]
+ except:
+ raise SkinError("component with name '" + wname + "' was not found in skin of screen '" + name + "'!")
+ #print "WARNING: component with name '" + wname + "' was not found in skin of screen '" + name + "'!"
+
+# assert screen[wname] is not Source
+
+ # and collect attributes for this
+ collectAttributes(attributes, widget, skin_path_prefix, ignore=['name'])
+ elif wsource:
+ # get corresponding source
+ #print "Widget source=", wsource
+
+ while True: # until we found a non-obsolete source
+
+ # parse our current "wsource", which might specifiy a "related screen" before the dot,
+ # for example to reference a parent, global or session-global screen.
+ scr = screen
+
+ # resolve all path components
+ path = wsource.split('.')
+ while len(path) > 1:
+ scr = screen.getRelatedScreen(path[0])
+ if scr is None:
+ #print wsource
+ #print name
+ raise SkinError("specified related screen '" + wsource + "' was not found in screen '" + name + "'!")
+ path = path[1:]
+
+ # resolve the source.
+ source = scr.get(path[0])
+ if isinstance(source, ObsoleteSource):
+ # however, if we found an "obsolete source", issue warning, and resolve the real source.
+ print "WARNING: SKIN '%s' USES OBSOLETE SOURCE '%s', USE '%s' INSTEAD!" % (name, wsource, source.new_source)
+ print "OBSOLETE SOURCE WILL BE REMOVED %s, PLEASE UPDATE!" % (source.removal_date)
+ if source.description:
+ print source.description
+
+ wsource = source.new_source
+ else:
+ # otherwise, use that source.
+ break
+
+ if source is None:
+ raise SkinError("source '" + wsource + "' was not found in screen '" + name + "'!")
+
+ wrender = get_attr('render')
+
+ if not wrender:
+ raise SkinError("you must define a renderer with render= for source '%s'" % (wsource))
+
+ for converter in widget.findall("convert"):
+ ctype = converter.get('type')
+ assert ctype, "'convert'-tag needs a 'type'-attribute"
+ #print "Converter:", ctype
+ #parms = mergeText(converter.childNodes).strip()
+ try:
+ parms = converter.text.strip()
+ except:
+ parms = ""
+ #print "Params:", ctype
+ converter_class = my_import('.'.join(["Components", "Converter", ctype])).__dict__.get(ctype)
+
+ c = None
+
+ for i in source.downstream_elements:
+ if isinstance(i, converter_class) and i.converter_arguments == parms:
+ c = i
+
+ if c is None:
+ print "allocating new converter!"
+ c = converter_class(parms)
+ c.connect(source)
+ else:
+ print "reused converter!"
+
+ source = c
+
+ renderer_class = my_import('.'.join(["Components", "Renderer", wrender])).__dict__.get(wrender)
+
+ renderer = renderer_class() # instantiate renderer
+
+ renderer.connect(source) # connect to source
+ attributes = renderer.skinAttributes = [ ]
+ collectAttributes(attributes, widget, skin_path_prefix, ignore=['render', 'source'])
+
+ screen.renderer.append(renderer)
+
+ from Components.GUIComponent import GUIComponent
+ nonvisited_components = [x for x in set(screen.keys()) - visited_components if isinstance(x, GUIComponent)]
+ assert not nonvisited_components, "the following components in %s don't have a skin entry: %s" % (name, ', '.join(nonvisited_components))