# HG changeset patch # User chewie@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1217957869 0 # Node ID ec653fde64d3413d725c0c9e0c9722e24a5ec0ae # Parent 6b2f3a151f81ca34985bc45c66e027a93918fa6e - modified pychan to accept r,g,b,a colors - default of a = 255, so you also just can use r, g, b - examples: - via XML: - via python: my_scroll_area_widget.background_color = 0,0,0,100 diff -r 6b2f3a151f81 -r ec653fde64d3 engine/extensions/pychan/attrs.py --- a/engine/extensions/pychan/attrs.py Tue Aug 05 14:56:54 2008 +0000 +++ b/engine/extensions/pychan/attrs.py Tue Aug 05 17:37:49 2008 +0000 @@ -54,13 +54,20 @@ class ColorAttr(Attr): def parse(self,value): + a = 255 try: - r,g,b = tuple(map(int,str(value).split(','))) + try: + r,g,b,a = tuple(map(int,str(value).split(','))) + for c in (r,g,b,a): + if not 0 <= c < 256: raise ParserError("Expected a color (Failed: 0 <= %d <= 255)" %c) + except: + r,g,b = tuple(map(int,str(value).split(','))) + for c in (r,g,b): + if not 0 <= c < 256: raise ParserError("Expected a color (Failed: 0 <= %d <= 255)" %c) except: raise ParserError("Expected an color.") - for c in (r,g,b): - if not 0 <= c < 256: raise ParserError("Expected a color (Failed: 0 <= %d <= 255)" %c) - return r,g,b + + return r,g,b,a class IntAttr(Attr): def parse(self,value):