Revision: 3568
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3568&view=rev
Author: jdh2358
Date: 2007-07-18 14:52:01 -0700 (Wed, 18 Jul 2007)
Log Message:
-----------
screwing aournd with delegates
Modified Paths:
--------------
trunk/matplotlib/mpl1/test.py
Modified: trunk/matplotlib/mpl1/test.py
===================================================================
--- trunk/matplotlib/mpl1/test.py 2007-07-18 21:30:12 UTC (rev 3567)
+++ trunk/matplotlib/mpl1/test.py 2007-07-18 21:52:01 UTC (rev 3568)
@@ -1,15 +1,36 @@
import numpy
-from enthought.traits.api import HasTraits, Array
-import mtraits
+from enthought.traits.api import HasTraits, Array, Delegate, Trait
+Affine = Array('d', (3,3),
+ value=numpy.array([[1,0,0], [0,1,0], [0,0,1]], numpy.float_))
-class Path(HasTraits):
- """
- The path is an object that talks to the backends, and is an
- intermediary between the high level path artists like Line and
- Polygon, and the backend renderer
- """
- strokecolor = mtraits.color('white')
+class C(HasTraits):
+ affine1 = Affine
+ affine2 = Affine
+ affine = Affine
-p = Path()
-print 'strokecolor', p.strokecolor
+ def _affine1_changed(self, old, new):
+ self.affine = numpy.dot(new, self.affine2)
+
+ def _affine2_changed(self, old, new):
+ self.affine = numpy.dot(self.affine1, new)
+
+
+class D(HasTraits):
+ affine = Delegate('c')
+ c = Trait(C)
+
+
+c = C()
+d = D()
+d.affine = c.affine
+
+
+print 'before c', type(c.affine), c.affine
+print 'before d', type(d.affine), d.affine
+
+c.affine1 = numpy.random.rand(3,3)
+print 'after c', type(c.affine), c.affine
+print 'after d', type(d.affine), d.affine
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|