Exemple #1
0
 def __init__(self, ctx, path=None, **kwargs):
     super(BezierPath, self).__init__(ctx)
     TransformMixin.__init__(self)
     ColorMixin.__init__(self, **kwargs)
     self._segment_cache = None
     if path is None:
         self._nsBezierPath = NSBezierPath.bezierPath()
     elif isinstance(path, (list,tuple)):
         self._nsBezierPath = NSBezierPath.bezierPath()
         self.extend(path)
     elif isinstance(path, BezierPath):
         self._nsBezierPath = path._nsBezierPath.copy()
         _copy_attrs(path, self, self.stateAttributes)
     elif isinstance(path, NSBezierPath):
         self._nsBezierPath = path
     else:
         raise NodeBoxError, "Don't know what to do with %s." % path
Exemple #2
0
    def __init__(self, ctx, path=None, **kwargs):
        super(BezierPath, self).__init__(ctx)
        TransformMixin.__init__(self)
        ColorMixin.__init__(self, **kwargs)

        self._segment_cache = None
        if path is None:
            self._elements = []
        elif isinstance(path, (list,tuple)):
            self._elements = []
            self.extend(path)
        elif isinstance(path, BezierPath):
            # XXX yeah yeah this sucks
            self._elements = []
            for p in path._elements:
                self._elements.append(p)
            _copy_attrs(path, self, self.stateAttributes)
        else:
            raise NodeBoxError, "Don't know what to do with %s." % path
Exemple #3
0
 def copy(self):
     new = self.__class__(self._ctx, self.text)
     _copy_attrs(self, new,
         ('x', 'y', 'width', 'height', '_transform', '_transformmode', 
         '_fillcolor', '_fontname', '_fontsize', '_align', '_lineheight'))
     return new
Exemple #4
0
 def inheritFromContext(self, ignore=()):
     attrs_to_copy = list(self.__class__.stateAttributes)
     [attrs_to_copy.remove(k) for k, v in _STATE_NAMES.items() if v in ignore]
     _copy_attrs(self._ctx, self, attrs_to_copy)
Exemple #5
0
 def copy(self):
     new = self.__class__(self._ctx)
     _copy_attrs(self, new, ('image', 'x', 'y', 'width', 'height', '_transform', '_transformmode', 'alpha', 'debugImage'))
     return new