|
From: <jd...@us...> - 2008-09-12 22:12:14
|
Revision: 6088
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6088&view=rev
Author: jdh2358
Date: 2008-09-12 21:21:16 +0000 (Fri, 12 Sep 2008)
Log Message:
-----------
added get_children to artist base class
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py 2008-09-12 02:35:02 UTC (rev 6087)
+++ trunk/matplotlib/lib/matplotlib/artist.py 2008-09-12 21:21:16 UTC (rev 6088)
@@ -166,10 +166,15 @@
traceback.print_exc()
print "while checking",self.__class__
- if hasattr(self,'get_children'):
- for a in self.get_children(): L.extend(a.hitlist(event))
+
+ for a in self.get_children():
+ L.extend(a.hitlist(event))
return L
+ def get_children(self):
+ 'return a list of the child artist this artist contains'
+ return []
+
def contains(self, mouseevent):
"""Test whether the artist contains the mouse event.
@@ -224,8 +229,8 @@
self.figure.canvas.pick_event(mouseevent, self, **prop)
# Pick children
- if hasattr(self,'get_children'):
- for a in self.get_children(): a.pick(mouseevent)
+ for a in self.get_children():
+ a.pick(mouseevent)
def set_picker(self, picker):
"""
@@ -538,14 +543,14 @@
artists = []
- if hasattr(self, 'get_children'):
- for c in self.get_children():
- if matchfunc(c):
- artists.append(c)
- artists.extend([thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc)])
- else:
- if matchfunc(self):
- artists.append(self)
+
+ for c in self.get_children():
+ if matchfunc(c):
+ artists.append(c)
+ artists.extend([thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc)])
+
+ if matchfunc(self):
+ artists.append(self)
return artists
@@ -761,14 +766,14 @@
artists = []
- if hasattr(self, 'get_children'):
- for c in self.get_children():
- if matchfunc(c):
- artists.append(c)
- artists.extend([thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc)])
- else:
- if matchfunc(self):
- artists.append(self)
+
+ for c in self.get_children():
+ if matchfunc(c):
+ artists.append(c)
+ artists.extend([thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc)])
+
+ if matchfunc(self):
+ artists.append(self)
return artists
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-09-12 02:35:02 UTC (rev 6087)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-09-12 21:21:16 UTC (rev 6088)
@@ -944,7 +944,7 @@
break
parent = None
for p in under:
- if hasattr(p,'getchildren') and h in p.get_children():
+ if h in p.get_children():
parent = p
break
h = parent
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-09-12 02:35:02 UTC (rev 6087)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-09-12 21:21:16 UTC (rev 6088)
@@ -2346,14 +2346,16 @@
class FormatInt(FormatObj):
def toval(self, x):
- return x
+ return int(x)
def fromstr(self, s):
return int(s)
class FormatBool(FormatObj):
+
+
def toval(self, x):
- return x
+ return str(x)
def fromstr(self, s):
return bool(s)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|