Changeset 3657:c9d539a13b98 in livinglogic.python.xist

Show
Ignore:
Timestamp:
12/28/08 21:11:19 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add UL4 support for color methods witha() and withlum(). Fix UL4 repr of colors.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/ul4c.py

    r3651 r3657  
    10461046                        raise UnknownMethodError(opcode.arg) 
    10471047                elif opcode.code == "callmeth1": 
    1048                     if opcode.arg in ("split", "rsplit", "strip", "lstrip", "rstrip", "startswith", "endswith", "find", "get"): 
     1048                    if opcode.arg in ("split", "rsplit", "strip", "lstrip", "rstrip", "startswith", "endswith", "find", "get", "withlum", "witha"): 
    10491049                        _code("reg%d = reg%d.%s(reg%d)" % (opcode.r1, opcode.r2, opcode.arg, opcode.r3)) 
    10501050                    elif opcode.arg == "format": 
     
    24292429    elif isinstance(obj, datetime.datetime): 
    24302430        return unicode(obj.isoformat()) 
     2431    elif isinstance(obj, color.Color): 
     2432        if obj[3] == 0xff: 
     2433            s = "#%02x%02x%02x" % (obj[0], obj[1], obj[2]) 
     2434            if s[1]==s[2] and s[3]==s[4] and s[5]==s[6]: 
     2435                return "#%s%s%s" % (s[1], s[3], s[5]) 
     2436            return s 
     2437        else: 
     2438            s = "#%02x%02x%02x%02x" % obj 
     2439            if s[1]==s[2] and s[3]==s[4] and s[5]==s[6] and s[7]==s[8]: 
     2440                return "#%s%s%s%s" % (s[1], s[3], s[5], s[7]) 
     2441            return s 
    24312442    elif isinstance(obj, list): 
    24322443        return u"[%s]" % u", ".join(_repr(item) for item in obj)