+ # and collect attributes for this
+ collectAttributes(attributes, widget, skin_path_prefix, ignore=['name'])
+ elif wsource:
+ # get corresponding source
+ source = screen.get(wsource)
+ if source is None:
+ raise SkinError("source '" + wsource + "' was not found in screen '" + name + "'!")
+
+ wrender = widget.getAttribute('render')
+
+ if not wrender:
+ raise SkinError("you must define a renderer with render= for source '%s'" % (wsource))
+
+ for converter in elementsWithTag(widget.childNodes, "convert"):
+ ctype = converter.getAttribute('type')
+ assert ctype, "'convert'-tag needs a 'type'-attribute"
+ parms = mergeText(converter.childNodes).strip()
+ 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 conveter!"
+
+ 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)