Show
Ignore:
Timestamp:
10/01/07 15:37:11 (15 months ago)
Author:
fdb
Message:

vdiff and two compliance tests for NodeBox?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nodebox/trunk/src/nodebox/graphics/cocoa.py

    r159 r175  
    210210        if path is None: 
    211211            self._nsBezierPath = NSBezierPath.bezierPath() 
    212         elif isinstance(path, list): 
     212        elif isinstance(path, (list,tuple)): 
    213213            self._nsBezierPath = NSBezierPath.bezierPath() 
    214214            self.extend(path) 
     
    293293        self._segment_cache = None 
    294294        for el in pathElements: 
    295             self.append(el) 
     295            if isinstance(el, (list, tuple)): 
     296                x, y = el 
     297                if len(self) == 0: 
     298                    cmd = MOVETO 
     299                else: 
     300                    cmd = LINETO 
     301                self.append(PathElement(cmd, ((x, y),))) 
     302            elif isinstance(el, PathElement): 
     303                self.append(el) 
     304            else: 
     305                raise NodeBoxError, "Don't know how to handle %s" % el 
    296306 
    297307    def append(self, el): 
     
    480490            params = len(args) 
    481491 
    482         if params == 1 and isinstance(args[0], Color): 
     492        if params == 1 and args[0] is None: 
     493            clr = NSColor.colorWithDeviceWhite_alpha_(0.0, 0.0) 
     494        elif params == 1 and isinstance(args[0], Color): 
    483495            clr = args[0]._cmyk 
    484496        elif params == 1 and isinstance(args[0], NSColor): 
     
    15581570    def drawpath(self, path, **kwargs): 
    15591571        BezierPath.checkKwargs(kwargs) 
    1560         if isinstance(path, list): 
    1561             path = BezierPath(self, path, kwargs) 
     1572        if isinstance(path, (list, tuple)): 
     1573            path = self.BezierPath(path, **kwargs) 
    15621574        path.inheritFromContext(kwargs.keys()) 
    15631575        path.draw()