- if attrib == 'position':
- guiObject.move(parsePosition(value))
- elif attrib == 'size':
- guiObject.resize(parseSize(value))
- elif attrib == 'title':
- guiObject.setTitle(value)
- elif attrib != 'name':
- print "unsupported attribute " + attrib + "=" + value
+ try:
+ if attrib == 'position':
+ guiObject.move(parsePosition(value))
+ elif attrib == 'size':
+ guiObject.resize(parseSize(value))
+ elif attrib == 'title':
+ guiObject.setTitle(value)
+ elif attrib == 'text':
+ guiObject.setText(value)
+ elif attrib == 'font':
+ guiObject.setFont(parseFont(value))
+ elif attrib == "pixmap":
+ ptr = gPixmapPtr()
+ if loadPNG(ptr, value):
+ raise "loading PNG failed!"
+ x = ptr
+ ptr = ptr.__deref__()
+ print desktop
+ desktop.makeCompatiblePixmap(ptr)
+ guiObject.setPixmap(ptr)
+# guiObject.setPixmapFromFile(value)
+ elif attrib == "valign":
+ try:
+ guiObject.setVAlign(
+ { "top": guiObject.alignTop,
+ "center": guiObject.alignCenter,
+ "bottom": guiObject.alignBottom
+ }[value])
+ except KeyError:
+ print "valign must be either top, center or bottom!"
+ elif attrib == "halign":
+ try:
+ guiObject.setHAlign(
+ { "left": guiObject.alignLeft,
+ "center": guiObject.alignCenter,
+ "right": guiObject.alignRight,
+ "block": guiObject.alignBlock
+ }[value])
+ except KeyError:
+ print "halign must be either left, center, right or block!"
+ elif attrib == "flags":
+ flags = value.split(',')
+ for f in flags:
+ try:
+ fv = eWindow.__dict__[f]
+ guiObject.setFlag(fv)
+ except KeyError:
+ print "illegal flag %s!" % f
+ elif attrib == "backgroundColor":
+ guiObject.setBackgroundColor(parseColor(value))
+ elif attrib != 'name':
+ print "unsupported attribute " + attrib + "=" + value
+ except AttributeError:
+ print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)