Revision: 6793
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6793&view=rev
Author:   mdboom
Date:     2009-01-16 18:45:18 +0000 (Fri, 16 Jan 2009)

Log Message:
-----------
Use "real" decorators, now that we don't support Python 2.3

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
    trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
    trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
    trunk/matplotlib/lib/matplotlib/collections.py
    trunk/matplotlib/lib/matplotlib/path.py
    trunk/matplotlib/lib/matplotlib/transforms.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py   2009-01-16 
18:24:19 UTC (rev 6792)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py   2009-01-16 
18:45:18 UTC (rev 6793)
@@ -121,7 +121,7 @@
         ctx.stroke()
 
 
-    #...@staticmethod
+    @staticmethod
     def convert_path(ctx, tpath):
         for points, code in tpath.iter_segments():
             if code == Path.MOVETO:
@@ -136,7 +136,6 @@
                 ctx.curve_to(*points)
             elif code == Path.CLOSEPOLY:
                 ctx.close_path()
-    convert_path = staticmethod(convert_path)
 
 
     def draw_path(self, gc, path, transform, rgbFace=None):

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2009-01-16 
18:24:19 UTC (rev 6792)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2009-01-16 
18:45:18 UTC (rev 6793)
@@ -349,7 +349,10 @@
             if self._need_redraw:
                 x, y, w, h = self.allocation
                 self._pixmap_prepare (w, h)
-                self._render_figure(self._pixmap, w, h)
+                try:
+                    self._render_figure(self._pixmap, w, h)
+                except:
+                    pass
                 self._need_redraw = False
 
             x, y, w, h = event.area

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py      2009-01-16 
18:24:19 UTC (rev 6792)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py      2009-01-16 
18:45:18 UTC (rev 6793)
@@ -303,7 +303,7 @@
                 gfx_ctx.Clip(new_bounds[0], self.height - new_bounds[1] - 
new_bounds[3],
                              new_bounds[2], new_bounds[3])
 
-    #...@staticmethod
+    @staticmethod
     def convert_path(gfx_ctx, tpath):
         wxpath = gfx_ctx.CreatePath()
         for points, code in tpath.iter_segments():
@@ -318,7 +318,6 @@
             elif code == Path.CLOSEPOLY:
                 wxpath.CloseSubpath()
         return wxpath
-    convert_path = staticmethod(convert_path)
 
     def draw_path(self, gc, path, transform, rgbFace=None):
         gc.select()

Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py      2009-01-16 18:24:19 UTC 
(rev 6792)
+++ trunk/matplotlib/lib/matplotlib/collections.py      2009-01-16 18:45:18 UTC 
(rev 6793)
@@ -565,7 +565,7 @@
                 self._meshWidth, self._meshHeight, self._coordinates)
         return self._paths
 
-    #...@staticmethod
+    @staticmethod
     def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
         """
         Converts a given mesh into a sequence of
@@ -590,7 +590,6 @@
                     ), axis=2)
         points = points.reshape((meshWidth * meshHeight, 5, 2))
         return [Path(x) for x in points]
-    convert_mesh_to_paths = staticmethod(convert_mesh_to_paths)
 
     def get_datalim(self, transData):
         return self._bbox

Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py     2009-01-16 18:24:19 UTC (rev 
6792)
+++ trunk/matplotlib/lib/matplotlib/path.py     2009-01-16 18:45:18 UTC (rev 
6793)
@@ -117,7 +117,7 @@
         self.codes = codes
         self.vertices = vertices
 
-    #...@classmethod
+    @classmethod
     def make_compound_path(cls, *args):
         """
         (staticmethod) Make a compound path from a list of Path
@@ -139,7 +139,6 @@
             i += length
 
         return cls(vertices, codes)
-    make_compound_path = classmethod(make_compound_path)
 
     def __repr__(self):
         return "Path(%s, %s)" % (self.vertices, self.codes)
@@ -337,7 +336,7 @@
         return convert_path_to_polygons(self, transform, width, height)
 
     _unit_rectangle = None
-    #...@classmethod
+    @classmethod
     def unit_rectangle(cls):
         """
         (staticmethod) Returns a :class:`Path` of the unit rectangle
@@ -347,10 +346,10 @@
             cls._unit_rectangle = \
                 cls([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 
0.0]])
         return cls._unit_rectangle
-    unit_rectangle = classmethod(unit_rectangle)
 
     _unit_regular_polygons = WeakValueDictionary()
-    #...@classmethod
+
+    @classmethod
     def unit_regular_polygon(cls, numVertices):
         """
         (staticmethod) Returns a :class:`Path` for a unit regular
@@ -371,10 +370,10 @@
             path = cls(verts)
             cls._unit_regular_polygons[numVertices] = path
         return path
-    unit_regular_polygon = classmethod(unit_regular_polygon)
 
     _unit_regular_stars = WeakValueDictionary()
-    #...@classmethod
+
+    @classmethod
     def unit_regular_star(cls, numVertices, innerCircle=0.5):
         """
         (staticmethod) Returns a :class:`Path` for a unit regular star
@@ -397,9 +396,8 @@
             path = cls(verts)
             cls._unit_regular_polygons[(numVertices, innerCircle)] = path
         return path
-    unit_regular_star = classmethod(unit_regular_star)
 
-    #...@classmethod
+    @classmethod
     def unit_regular_asterisk(cls, numVertices):
         """
         (staticmethod) Returns a :class:`Path` for a unit regular
@@ -407,10 +405,10 @@
         centered at (0, 0).
         """
         return cls.unit_regular_star(numVertices, 0.0)
-    unit_regular_asterisk = classmethod(unit_regular_asterisk)
 
     _unit_circle = None
-    #...@classmethod
+
+    @classmethod
     def unit_circle(cls):
         """
         (staticmethod) Returns a :class:`Path` of the unit circle.
@@ -470,9 +468,8 @@
 
             cls._unit_circle = cls(vertices, codes)
         return cls._unit_circle
-    unit_circle = classmethod(unit_circle)
 
-    #...@classmethod
+    @classmethod
     def arc(cls, theta1, theta2, n=None, is_wedge=False):
         """
         (staticmethod) Returns an arc on the unit circle from angle
@@ -549,9 +546,8 @@
         vertices[vertex_offset+2:end:3, 1] = yB
 
         return cls(vertices, codes)
-    arc = classmethod(arc)
 
-    #...@classmethod
+    @classmethod
     def wedge(cls, theta1, theta2, n=None):
         """
         (staticmethod) Returns a wedge of the unit circle from angle
@@ -562,10 +558,10 @@
         determined based on the delta between *theta1* and *theta2*.
         """
         return cls.arc(theta1, theta2, n, True)
-    wedge = classmethod(wedge)
 
     _hatch_dict = maxdict(8)
-    #...@classmethod
+
+    @classmethod
     def hatch(cls, hatchpattern, density=6):
         """
         Given a hatch specifier, *hatchpattern*, generates a Path that
@@ -584,7 +580,6 @@
         hatch_path = get_path(hatchpattern, density)
         cls._hatch_dict[(hatchpattern, density)] = hatch_path
         return hatch_path
-    hatch = classmethod(hatch)
 
 _get_path_collection_extents = get_path_collection_extents
 def get_path_collection_extents(*args):

Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py       2009-01-16 18:24:19 UTC 
(rev 6792)
+++ trunk/matplotlib/lib/matplotlib/transforms.py       2009-01-16 18:45:18 UTC 
(rev 6793)
@@ -667,7 +667,7 @@
         bbox.update_from_data_xy(corners_rotated, ignore=True)
         return bbox
 
-    #...@staticmethod
+    @staticmethod
     def union(bboxes):
         """
         Return a :class:`Bbox` that contains all of the given bboxes.
@@ -692,7 +692,6 @@
             y1 = max(y1, np.max(ys))
 
         return Bbox.from_extents(x0, y0, x1, y1)
-    union = staticmethod(union)
 
 
 class Bbox(BboxBase):
@@ -724,16 +723,15 @@
             TransformNode.invalidate(self)
 
     _unit_values = np.array([[0.0, 0.0], [1.0, 1.0]], np.float_)
-    #...@staticmethod
+    @staticmethod
     def unit():
         """
         (staticmethod) Create a new unit :class:`Bbox` from (0, 0) to
         (1, 1).
         """
         return Bbox(Bbox._unit_values.copy())
-    unit = staticmethod(unit)
 
-    #...@staticmethod
+    @staticmethod
     def from_bounds(x0, y0, width, height):
         """
         (staticmethod) Create a new :class:`Bbox` from *x0*, *y0*,
@@ -742,9 +740,8 @@
         *width* and *height* may be negative.
         """
         return Bbox.from_extents(x0, y0, x0 + width, y0 + height)
-    from_bounds = staticmethod(from_bounds)
 
-    #...@staticmethod
+    @staticmethod
     def from_extents(*args):
         """
         (staticmethod) Create a new Bbox from *left*, *bottom*,
@@ -754,7 +751,6 @@
         """
         points = np.array(args, dtype=np.float_).reshape(2, 2)
         return Bbox(points)
-    from_extents = staticmethod(from_extents)
 
     def __repr__(self):
         return 'Bbox(%s)' % repr(self._points)
@@ -1311,14 +1307,13 @@
     def __array__(self, *args, **kwargs):
         return self.get_matrix()
 
-    #...@staticmethod
+    @staticmethod
     def _concat(a, b):
         """
         Concatenates two transformation matrices (represented as numpy
         arrays) together.
         """
         return np.dot(b, a)
-    _concat = staticmethod(_concat)
 
     def get_matrix(self):
         """
@@ -1387,7 +1382,7 @@
         mtx = self.get_matrix()
         return tuple(mtx[:2].swapaxes(0, 1).flatten())
 
-    #...@staticmethod
+    @staticmethod
     def matrix_from_values(a, b, c, d, e, f):
         """
         (staticmethod) Create a new transformation matrix as a 3x3
@@ -1398,7 +1393,6 @@
           0 0 1
         """
         return np.array([[a, c, e], [b, d, f], [0.0, 0.0, 1.0]], np.float_)
-    matrix_from_values = staticmethod(matrix_from_values)
 
     def transform(self, points):
         mtx = self.get_matrix()
@@ -1473,7 +1467,7 @@
             return 0
         return -1
 
-    #...@staticmethod
+    @staticmethod
     def from_values(a, b, c, d, e, f):
         """
         (staticmethod) Create a new Affine2D instance from the given
@@ -1486,7 +1480,6 @@
         return Affine2D(
             np.array([a, c, e, b, d, f, 0.0, 0.0, 1.0], np.float_)
             .reshape((3,3)))
-    from_values = staticmethod(from_values)
 
     def get_matrix(self):
         """
@@ -1519,7 +1512,7 @@
         self._mtx = other.get_matrix()
         self.invalidate()
 
-    #...@staticmethod
+    @staticmethod
     def identity():
         """
         (staticmethod) Return a new :class:`Affine2D` object that is
@@ -1529,7 +1522,6 @@
         the faster :class:`IdentityTransform` class instead.
         """
         return Affine2D(np.identity(3))
-    identity = staticmethod(identity)
 
     def clear(self):
         """


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to