Changeset 175
- Timestamp:
- 10/01/07 15:37:11 (14 months ago)
- Location:
- nodebox/trunk/src
- Files:
-
- 10 added
- 5 modified
- 2 copied
-
Changes.txt (modified) (2 diffs)
-
DrawingPrimitives.py (modified) (1 diff)
-
nodebox/graphics/cocoa.py (modified) (4 diffs)
-
nodebox/util/__init__.py (modified) (1 diff)
-
nodebox/util/vdiff.py (copied) (copied from nodebox/branches/modulize/nodebox/util/vdiff.py) (1 diff)
-
tests (added)
-
tests/graphics (added)
-
tests/graphics/001-basic-primitives.png (added)
-
tests/graphics/001-basic-primitives.py (added)
-
tests/graphics/001-basic-primitives.result.png (added)
-
tests/graphics/002-text.png (added)
-
tests/graphics/002-text.py (added)
-
tests/graphics/__init__.py (added)
-
tests/graphics/runtests.py (added)
-
tests/graphics/tests.py (added)
-
tests/vdiff (copied) (copied from nodebox/branches/modulize/tests/vdiff)
-
tests/vdiff/tests.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nodebox/trunk/src/Changes.txt
r159 r175 9 9 * Colors are no longer calibrated in RGB color space. This gives correct results. 10 10 * Added new outputmode command that you can set to CMYK or RGB. All colors will adhere to the color mode. 11 * NodeBox is now packaged: DrawingPrimitives is obsoleted in favor of nodebox.graphics. 12 This also means you can work directly with the context: 13 14 from nodebox.graphics import Context 15 ctx = Context() 16 ctx.background(None) # Make transparent PNG 17 ctx.size(300, 300) 18 ctx.rect(0, 0, 100, 100, fill=(0.5, 0.1, 0.3)) 19 ctx.save("test.png") # Supported: PDF, PNG, TIFF, JPEG, GIF 20 11 21 * BezierPath, Image and Text objects support copying: path.copy() gives you a fresh copy you can transform. 12 22 * Text input now gets converted to unicode, which means you can do: … … 28 38 canvas.clear() # The canvas is now empty when drawn on-screen 29 39 30 * NodeBox is now packaged: DrawingPrimitives is obsoleted in favor of nodebox.graphics. 31 * Access NodeBox from the command line: 40 * Access NodeBox from the command line for very simple scripts: 32 41 33 42 from nodebox.console import make_movie -
nodebox/trunk/src/DrawingPrimitives.py
r159 r175 6 6 import nodebox.graphics.cocoa 7 7 from nodebox.graphics.cocoa import * 8 from nodebox.util import * 8 9 9 10 __all__ = nodebox.graphics.cocoa.__all__ -
nodebox/trunk/src/nodebox/graphics/cocoa.py
r159 r175 210 210 if path is None: 211 211 self._nsBezierPath = NSBezierPath.bezierPath() 212 elif isinstance(path, list):212 elif isinstance(path, (list,tuple)): 213 213 self._nsBezierPath = NSBezierPath.bezierPath() 214 214 self.extend(path) … … 293 293 self._segment_cache = None 294 294 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 296 306 297 307 def append(self, el): … … 480 490 params = len(args) 481 491 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): 483 495 clr = args[0]._cmyk 484 496 elif params == 1 and isinstance(args[0], NSColor): … … 1558 1570 def drawpath(self, path, **kwargs): 1559 1571 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) 1562 1574 path.inheritFromContext(kwargs.keys()) 1563 1575 path.draw() -
nodebox/trunk/src/nodebox/util/__init__.py
r159 r175 1 __all__ = ('grid', 'random', 'files', 'autotext') 1 from random import choice 2 3 __all__ = ('grid', 'random', 'choice', 'files', 'autotext') 2 4 3 5 ### Utilities ### -
nodebox/trunk/src/nodebox/util/vdiff.py
r18 r175 145 145 except: 146 146 threshold = 0 147 statistics(fname1, fname2, threshold) 147 statistics(fname1, fname2, threshold) -
nodebox/trunk/src/tests/vdiff/tests.py
r15 r175 1 1 import os, glob 2 import vdiff2 from nodebox.util import vdiff 3 3 4 TEST_PATH = ' vdiff-tests'4 TEST_PATH = 'images' 5 5 create_compare_image = True 6 6 … … 24 24 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 25 25 <title>vdiff tests</title> 26 <link rel="stylesheet" type="text/css" href=" vdiff-tests/vdiff.css" media="all">26 <link rel="stylesheet" type="text/css" href="images/vdiff.css" media="all"> 27 27 </head> 28 28 <body> … … 56 56 fp.write(html) 57 57 fp.close() 58 59 print "Generated test-results.html"
