SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(16)
2
(7)
3
(4)
4
5
6
(4)
7
(5)
8
(6)
9
(7)
10
(4)
11
12
(2)
13
(5)
14
(3)
15
16
(5)
17
(1)
18
19
20
(5)
21
(7)
22
(3)
23
(5)
24
(1)
25
26
27
(6)
28
(7)
29
(3)
30
(8)
31
(6)

Showing results of 120

<< < 1 2 3 4 5 > >> (Page 2 of 5)
From: <md...@us...> - 2007年08月27日 19:33:51
Revision: 3741
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3741&view=rev
Author: mdboom
Date: 2007年08月27日 12:33:45 -0700 (2007年8月27日)
Log Message:
-----------
Allow markup kwarg in more places.
Modified Paths:
--------------
 trunk/matplotlib/examples/quiver_demo.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/quiver.py
 trunk/matplotlib/lib/matplotlib/table.py
Modified: trunk/matplotlib/examples/quiver_demo.py
===================================================================
--- trunk/matplotlib/examples/quiver_demo.py	2007年08月27日 19:32:38 UTC (rev 3740)
+++ trunk/matplotlib/examples/quiver_demo.py	2007年08月27日 19:33:45 UTC (rev 3741)
@@ -17,8 +17,9 @@
 #1
 figure()
 Q = quiver( U, V)
-qk = quiverkey(Q, 0.5, 0.92, 2, '2 m/s', labelpos='W',
- fontproperties={'weight': 'bold'})
+qk = quiverkey(Q, 0.5, 0.92, 2, r'2ドル \frac{m}{s}$', labelpos='W',
+ fontproperties={'weight': 'bold'},
+ markup="tex")
 l,r,b,t = axis()
 dx, dy = r-l, t-b
 axis([l-0.05*dx, r+0.05*dx, b-0.05*dy, t+0.05*dy])
@@ -28,10 +29,11 @@
 #2
 figure()
 Q = quiver( X, Y, U, V, units='width')
-qk = quiverkey(Q, 0.9, 0.95, 2, '2 m/s',
- labelpos='E',
- coordinates='figure',
- fontproperties={'weight': 'bold'})
+qk = quiverkey(Q, 0.9, 0.95, 2, r'2ドル \frac{m}{s}$',
+ labelpos='E',
+ coordinates='figure',
+ fontproperties={'weight': 'bold'},
+ markup="tex")
 axis([-1, 7, -1, 7])
 title('scales with plot width, not view')
 
@@ -39,7 +41,7 @@
 figure()
 Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
 pivot='mid', color='r', units='inches' )
-qk = quiverkey(Q, 0.5, 0.03, 1, '1 m/s', fontproperties={'weight': 'bold'})
+qk = quiverkey(Q, 0.5, 0.03, 1, r'1ドル \frac{m}{s}$', fontproperties={'weight': 'bold'}, markup="tex")
 plot( X[::3, ::3], Y[::3, ::3], 'k.')
 axis([-1, 7, -1, 7])
 title("pivot='mid'; every third arrow; units='inches'")
@@ -48,9 +50,10 @@
 figure()
 M = sqrt(pow(U, 2) + pow(V, 2))
 Q = quiver( X, Y, U, V, M, units='x', pivot='tip', width=0.022, scale=1/0.15)
-qk = quiverkey(Q, 0.9, 1.05, 1, '1 m/s',
+qk = quiverkey(Q, 0.9, 1.05, 1, r'1ドル \frac{m}{s}$',
 labelpos='E',
- fontproperties={'weight': 'bold'})
+ fontproperties={'weight': 'bold'},
+ markup="tex")
 plot(X, Y, 'k.')
 axis([-1, 7, -1, 7])
 title("scales with x view; pivot='tip'")
@@ -60,7 +63,7 @@
 Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
 color='r', units='x',
 linewidths=(2,), edgecolors=('k'), headaxislength=5 )
-qk = quiverkey(Q, 0.5, 0.03, 1, '1 m/s', fontproperties={'weight': 'bold'})
+qk = quiverkey(Q, 0.5, 0.03, 1, r'1ドル \frac{m}{s}$', fontproperties={'weight': 'bold'}, markup="tex")
 axis([-1, 7, -1, 7])
 title("triangular head; scale with x view; black edges")
 
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2007年08月27日 19:32:38 UTC (rev 3740)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2007年08月27日 19:33:45 UTC (rev 3741)
@@ -123,7 +123,8 @@
 handletextsep = None, # the space between the legend line and legend text
 axespad = None, # the border between the axes and legend edge
 
- shadow= None,
+ shadow = None,
+ markup = None
 ):
 """
 parent # the artist that contains the legend
@@ -203,7 +204,7 @@
 else:
 self._xdata = npy.linspace(left, left + self.handlelen, self.numpoints)
 textleft = left+ self.handlelen+self.handletextsep
- self.texts = self._get_texts(labels, textleft, top)
+ self.texts = self._get_texts(labels, textleft, top, markup)
 self.legendHandles = self._get_handles(handles, self.texts)
 
 
@@ -404,7 +405,7 @@
 'return a list of text.Text instance in the legend'
 return silent_list('Text', self.texts)
 
- def _get_texts(self, labels, left, upper):
+ def _get_texts(self, labels, left, upper, markup):
 
 # height in axes coords
 HEIGHT = self._approx_text_height()
@@ -419,6 +420,7 @@
 fontproperties=self.prop,
 verticalalignment='top',
 horizontalalignment='left',
+ markup=markup
 )
 self._set_artist_props(text)
 ret.append(text)
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py	2007年08月27日 19:32:38 UTC (rev 3740)
+++ trunk/matplotlib/lib/matplotlib/quiver.py	2007年08月27日 19:33:45 UTC (rev 3741)
@@ -173,12 +173,14 @@
 self.labelpos = kw.pop('labelpos', 'N')
 self.labelcolor = kw.pop('labelcolor', None)
 self.fontproperties = kw.pop('fontproperties', dict())
+ self.markup = kw.pop('markup', None)
 self.kw = kw
 _fp = self.fontproperties
 self.text = text.Text(text=label,
 horizontalalignment=self.halign[self.labelpos],
 verticalalignment=self.valign[self.labelpos],
- fontproperties=font_manager.FontProperties(**_fp))
+ fontproperties=font_manager.FontProperties(**_fp),
+ markup=self.markup)
 if self.labelcolor is not None:
 self.text.set_color(self.labelcolor)
 self._initialized = False
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py	2007年08月27日 19:32:38 UTC (rev 3740)
+++ trunk/matplotlib/lib/matplotlib/table.py	2007年08月27日 19:33:45 UTC (rev 3741)
@@ -47,6 +47,8 @@
 fill=True,
 text='',
 loc=None,
+ fontproperties=None,
+ markup=None
 ):
 
 # Call base
@@ -58,7 +60,8 @@
 # Create text object
 if loc is None: loc = 'right'
 self._loc = loc
- self._text = Text(x=xy[0], y=xy[1], text=text)
+ self._text = Text(x=xy[0], y=xy[1], text=text,
+ fontproperties=fontproperties, markup=markup)
 self._text.set_clip_on(False)
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月27日 19:32:41
Revision: 3740
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3740&view=rev
Author: mdboom
Date: 2007年08月27日 12:32:38 -0700 (2007年8月27日)
Log Message:
-----------
Better mathtext error messages. Fix bug when using \sqrt without
explicit root.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月27日 18:51:22 UTC (rev 3739)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月27日 19:32:38 UTC (rev 3740)
@@ -1932,7 +1932,14 @@
 
 def parse(self, s, fonts_object, fontsize, dpi):
 self._state_stack = [self.State(fonts_object, 'default', fontsize, dpi)]
- self._expression.parseString(s)
+ try:
+ self._expression.parseString(s)
+ except ParseException, err:
+ raise ValueError("\n".join([
+ "",
+ err.line,
+ " " * (err.column - 1) + "^",
+ str(err)]))
 return self._expr
 
 # The state of the parser is maintained in a stack. Upon
@@ -2155,7 +2162,7 @@
 super = next1
 sub = next2
 else:
- raise ParseFatalException("Subscript/superscript sequence is too long.")
+ raise ParseFatalException("Subscript/superscript sequence is too long. Use braces { } to remove ambiguity.")
 
 state = self.get_state()
 rule_thickness = state.font_output.get_underline_thickness(
@@ -2277,7 +2284,7 @@
 state.font, state.fontsize, state.dpi)
 
 if root is None:
- root = Box()
+ root = Box(0., 0., 0.)
 else:
 if not isinstance(root, ParseResults):
 raise ParseFatalException(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月27日 18:51:29
Revision: 3739
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3739&view=rev
Author: mdboom
Date: 2007年08月27日 11:51:22 -0700 (2007年8月27日)
Log Message:
-----------
Cleaned up some comments.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月27日 15:42:44 UTC (rev 3738)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月27日 18:51:22 UTC (rev 3739)
@@ -116,11 +116,6 @@
 
 - Certainly there are some...
 
-STATUS:
- The *Unicode* classes were incomplete when I found them, and have
- not been refactored to support intermingling of regular text and
- math text yet. They are most likely broken. -- Michael Droettboom, July 2007
-
 Author : John Hunter <jdh...@ac...>
 Michael Droettboom <md...@st...>
 (rewrite based on TeX box layout algorithms)
@@ -2400,9 +2395,3 @@
 font_output.mathtext_backend.fonts_object = None
 
 return result
-
-# math_parse_s_ft2font = math_parse_s_ft2font_common('Agg')
-# math_parse_s_ft2font_svg = math_parse_s_ft2font_common('SVG')
-# math_parse_s_ps = math_parse_s_ft2font_common('PS')
-# math_parse_s_pdf = math_parse_s_ft2font_common('PDF')
-# math_parse_s_cairo = math_parse_s_ft2font_common('Cairo')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月27日 15:42:50
Revision: 3738
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3738&view=rev
Author: mdboom
Date: 2007年08月27日 08:42:44 -0700 (2007年8月27日)
Log Message:
-----------
mathtext.* font rcParams now use fontconfig patterns to specify fonts.
Support converting FontProperties objects to/from fontconfig patterns.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/config/mpltraits.py
 trunk/matplotlib/lib/matplotlib/config/rcsetup.py
 trunk/matplotlib/lib/matplotlib/font_manager.py
 trunk/matplotlib/lib/matplotlib/rcsetup.py
 trunk/matplotlib/lib/matplotlib/text.py
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -161,14 +161,12 @@
 dvipnghack = T.false
 
 class mathtext(TConfig):
- handler = mplT.FontPropertiesHandler
- proxy = handler.FontPropertiesProxy
- cal = T.Trait(proxy(['cursive']), handler())
- rm = T.Trait(proxy(['serif']), handler())
- tt = T.Trait(proxy(['monospace']), handler())
- it = T.Trait(proxy(['serif'], style='oblique'), handler())
- bf = T.Trait(proxy(['serif'], weight='bold'), handler())
- sf = T.Trait(proxy(['sans-serif']), handler())
+ cal = T.Trait('cursive' , mplT.FontconfigPatternHandler())
+ rm = T.Trait('serif' , mplT.FontconfigPatternHandler())
+ tt = T.Trait('monospace' , mplT.FontconfigPatternHandler())
+ it = T.Trait('serif:oblique' , mplT.FontconfigPatternHandler())
+ bf = T.Trait('serif:bold' , mplT.FontconfigPatternHandler())
+ sf = T.Trait('sans' , mplT.FontconfigPatternHandler())
 use_cm = T.true
 fallback_to_cm = T.true
 
Modified: trunk/matplotlib/lib/matplotlib/config/mpltraits.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -4,6 +4,9 @@
 # Matplotlib-specific imports
 import cutils
 
+# For the fontconfig pattern parser
+from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
+
 # stolen from cbook
 def is_string_like(obj):
 if hasattr(obj, 'shape'): return 0 # this is a workaround
@@ -145,64 +148,14 @@
 'prism', 'prism_r', 'spectral', 'spectral_r', 'spring', 
 'spring_r', 'summer', 'summer_r', 'winter', 'winter_r']
 
-class FontPropertiesHandler(T.TraitHandler):
- class FontPropertiesProxy(object):
- # In order to build a FontProperties object, various rcParams must
- # already be known in order to set default values. That means a
- # FontProperties object can not be created from a config file,
- # since it depends on other values in the same config file. This
- # proxy class is used as a temporary storage area for the settings
- # in the config file, and the full FontProperties class is created
- # only when the class is first used. It is defined here rather than
- # in font_manager.py to avoid a cyclical import.
- def __init__(self,
- family = None,
- style = None,
- variant= None,
- weight = None,
- stretch= None,
- size = None,
- fname = None, # if this is set, it's a hardcoded filename to use
- ):
- self.__family = family
- self.__style = style
- self.__variant = variant
- self.__weight = weight
- self.__stretch = stretch
- self.__size = size
- self.__fname = fname
-
- self.__child = None
-
- def __get_child(self):
- if self.__child is None:
- from matplotlib.font_manager import FontProperties
- self.__child = FontProperties(
- family = self.__family,
- style = self.__style,
- variant = self.__variant,
- weight = self.__weight,
- stretch = self.__stretch,
- size = self.__size,
- fname = self.__fname)
- return self.__child
-
- def __getattr__(self, attr):
- return getattr(self.__get_child(), attr)
-
+class FontconfigPatternHandler(T.TraitHandler):
+ """This validates a fontconfig pattern by using the FontconfigPatternParser.
+ The results are not actually used here, since we can't instantiate a
+ FontProperties object at config-parse time."""
 def validate(self, object, name, value):
- from matplotlib.font_manager import FontProperties
- if is_string_like(value):
- try:
- proxy = eval("FontProperties(%s)" % value,
- {}, {'FontProperties': self.FontPropertiesProxy})
- except:
- pass
- else:
- return proxy
- else:
- return value
- self.error(object, name, value)
- 
+ # This will throw a ValueError if value does not parse correctly
+ parse_fontconfig_pattern(value)
+ return value
+
 def info(self):
- return 'a FontProperties object or a string containing the parameters to the FontProperties constructor.'
+ return """A fontconfig pattern. See the fontconfig user manual for more information."""
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -9,6 +9,7 @@
 """
 
 import os
+from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 
 class ValidateInStrings:
 def __init__(self, key, valid, ignorecase=False):
@@ -197,64 +198,10 @@
 return float(s)
 except ValueError:
 raise ValueError('not a valid font size')
-
-class FontPropertiesProxy:
- # In order to build a FontProperties object, various rcParams must
- # already be known in order to set default values. That means a
- # FontProperties object can not be created from a config file,
- # since it depends on other values in the same config file. This
- # proxy class is used as a temporary storage area for the settings
- # in the config file, and the full FontProperties class is created
- # only when the class is first used. It is defined here rather than
- # in font_manager.py to avoid a cyclical import.
- def __init__(self,
- family = None,
- style = None,
- variant= None,
- weight = None,
- stretch= None,
- size = None,
- fname = None, # if this is set, it's a hardcoded filename to use
- ):
- self.__family = family
- self.__style = style
- self.__variant = variant
- self.__weight = weight
- self.__stretch = stretch
- self.__size = size
- self.__fname = fname
-
- self.__child = None
-
- def __get_child(self):
- if self.__child is None:
- from font_manager import FontProperties
- self.__child = FontProperties(
- family = self.__family,
- style = self.__style,
- variant = self.__variant,
- weight = self.__weight,
- stretch = self.__stretch,
- size = self.__size,
- fname = self.__fname)
- return self.__child
-
- def __getattr__(self, attr):
- return getattr(self.__get_child(), attr)
 
 def validate_font_properties(s):
- parsed = False
- try:
- prop = eval(u'FontProperties(%s)' % s,
- {}, {'FontProperties': FontPropertiesProxy})
- except:
- pass
- else:
- parsed = isinstance(prop, FontPropertiesProxy)
- if not parsed:
- raise ValueError(
- 'Mathtext font specifier must be a set of arguments to the FontProperty constructor.')
- return prop
+ parse_fontconfig_pattern(s)
+ return s
 
 validate_markup = ValidateInStrings(
 'markup', 
@@ -418,12 +365,12 @@
 'text.fontsize' : ['medium', validate_fontsize],
 'text.markup' : ['plain', validate_markup],
 
- 'mathtext.cal' : [FontPropertiesProxy(['cursive']), validate_font_properties],
- 'mathtext.rm' : [FontPropertiesProxy(['serif']), validate_font_properties],
- 'mathtext.tt' : [FontPropertiesProxy(['monospace']), validate_font_properties],
- 'mathtext.it' : [FontPropertiesProxy(['serif'], style='oblique'), validate_font_properties],
- 'mathtext.bf' : [FontPropertiesProxy(['serif'], weight='bold'), validate_font_properties],
- 'mathtext.sf' : [FontPropertiesProxy(['sans-serif']), validate_font_properties],
+ 'mathtext.cal' : ['cursive', validate_font_properties],
+ 'mathtext.rm' : ['serif', validate_font_properties],
+ 'mathtext.tt' : ['monospace', validate_font_properties],
+ 'mathtext.it' : ['serif:italic', validate_font_properties],
+ 'mathtext.bf' : ['serif:bold', validate_font_properties],
+ 'mathtext.sf' : ['sans\-serif', validate_font_properties],
 'mathtext.use_cm' : [True, validate_bool],
 'mathtext.fallback_to_cm' : [True, validate_bool],
 
Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/font_manager.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -34,10 +34,14 @@
 """
 
 import os, sys, glob, shutil
+from sets import Set
 import matplotlib
 from matplotlib import afm
 from matplotlib import ft2font
 from matplotlib import rcParams, get_home, get_configdir
+from matplotlib.cbook import is_string_like
+from matplotlib.fontconfig_pattern import \
+ parse_fontconfig_pattern, generate_fontconfig_pattern
 
 try:
 import cPickle as pickle
@@ -48,7 +52,7 @@
 
 font_scalings = {'xx-small': 0.579, 'x-small': 0.694, 'small': 0.833,
 'medium': 1.0, 'large': 1.200, 'x-large': 1.440,
- 'xx-large': 1.728}
+ 'xx-large': 1.728, 'larger': 1.2, 'smaller': 0.833}
 
 weight_dict = {'light': 200, 'normal': 400, 'regular': 400, 'book': 400,
 'medium': 500, 'roman': 500, 'semibold': 600, 'demibold': 600,
@@ -552,8 +556,7 @@
 for j in [600, 700, 800, 900]:
 font[j] = temp[700]
 
-
-class FontProperties:
+class FontProperties(object):
 """
 A class for storing and manipulating font properties.
 
@@ -582,32 +585,37 @@
 The default font property for TrueType fonts is: sans-serif, normal,
 normal, normal, 400, scalable.
 
- The preferred usage of font sizes is to use the absolute values, e.g.
+ The preferred usage of font sizes is to use the relative values, e.g.
 large, instead of absolute font sizes, e.g. 12. This approach allows
 all text sizes to be made larger or smaller based on the font manager's
 default font size, i.e. by using the set_default_size() method of the
 font manager.
 
- Examples:
+ This class will also accept a fontconfig pattern, if it is the only
+ argument provided. fontconfig patterns are described here:
 
- # Load default font properties
- >>> p = FontProperties()
- >>> p.get_family()
- ['Bitstream Vera Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucida', 'Arial', 'Helvetica', 'sans-serif']
+ http://www.fontconfig.org/fontconfig-user.html
 
- # Change font family to 'fantasy'
- >>> p.set_family('fantasy')
- >>> p.get_family()
- ['Comic Sans MS', 'Chicago', 'Charcoal', 'Impact', 'Western', 'fantasy']
-
- # Make these fonts highest priority in font family
- >>> p.set_name(['foo', 'fantasy', 'bar', 'baz'])
- Font name 'fantasy' is a font family. It is being deleted from the list.
- >>> p.get_family()
- ['foo', 'bar', 'baz', 'Comic Sans MS', 'Chicago', 'Charcoal', 'Impact', 'Western', 'fantasy']
-
+ Note that matplotlib's internal font manager and fontconfig use a
+ different algorithm to lookup fonts, so the results of the same pattern
+ may be different in matplotlib than in other applications that use
+ fontconfig.
 """
 
+ class FontPropertiesSet(object):
+ """This class contains all of the default properties at the
+ class level, which are then overridden (only if provided) at
+ the instance level."""
+ family = rcParams['font.' + rcParams['font.family']]
+ if is_string_like(family):
+ family = [family]
+ slant = rcParams['font.style']
+ variant = rcParams['font.variant']
+ weight = rcParams['font.weight']
+ stretch = rcParams['font.stretch']
+ size = [rcParams['font.size']]
+ file = None
+ 
 def __init__(self,
 family = None,
 style = None,
@@ -615,42 +623,51 @@
 weight = None,
 stretch= None,
 size = None,
- fname = None, # if this is set, it's a hardcoded filename to use
+ fname = None, # if this is set, it's a hardcoded filename to use
+ _init = None # used only by copy()
 ):
 
+ self.__props = self.FontPropertiesSet()
 
- if family is None: family = rcParams['font.'+rcParams['font.family']]
- if style is None: style = rcParams['font.style']
- if variant is None: variant= rcParams['font.variant']
- if weight is None: weight = rcParams['font.weight']
- if stretch is None: stretch= rcParams['font.stretch']
- if size is None: size = rcParams['font.size']
-
+ # This is used only by copy()
+ if _init is not None:
+ self.__props.__dict__.update(_init)
+ return
+ 
 if isinstance(family, str):
+ # Treat family as a fontconfig pattern if it is the only
+ # parameter provided.
+ if (style is None and
+ variant is None and
+ weight is None and
+ stretch is None and
+ size is None and
+ fname is None):
+ self.__props.__dict__ = self._parse_fontconfig_pattern(family)
+ return
 family = [family]
- self.__family = family
- self.__style = style
- self.__variant = variant
- self.__weight = weight
- self.__stretch = stretch
- self.__size = size
- self.__parent_size = fontManager.get_default_size()
- self.fname = fname
 
+ self.set_family(family)
+ self.set_style(style)
+ self.set_variant(variant)
+ self.set_weight(weight)
+ self.set_stretch(stretch)
+ self.set_file(fname)
+ self.set_size(size)
+ 
+ def _parse_fontconfig_pattern(self, pattern):
+ return parse_fontconfig_pattern(pattern)
+
 def __hash__(self):
- return hash( (
- tuple(self.__family), self.__style, self.__variant,
- self.__weight, self.__stretch, self.__size,
- self.__parent_size, self.fname))
+ return hash(repr(self.__props))
 
 def __str__(self):
- return str((self.__family, self.__style, self.__variant,
- self.__weight, self.__stretch, self.__size))
-
+ return self.get_fontconfig_pattern()
+ 
 def get_family(self):
 """Return a list of font names that comprise the font family.
 """
- return self.__family
+ return self.__props.family
 
 def get_name(self):
 """Return the name of the font that best matches the font properties."""
@@ -658,120 +675,115 @@
 
 def get_style(self):
 """Return the font style. Values are: normal, italic or oblique."""
- return self.__style
+ return self.__props.slant
 
 def get_variant(self):
 """Return the font variant. Values are: normal or small-caps."""
- return self.__variant
+ return self.__props.variant
 
 def get_weight(self):
 """
 Return the font weight. See the FontProperties class for a
 a list of possible values.
 """
- return self.__weight
+ return self.__props.weight
 
 def get_stretch(self):
 """
 Return the font stretch or width. Options are: normal,
 narrow, condensed, or wide.
 """
- return self.__stretch
+ return self.__props.stretch
 
 def get_size(self):
 """Return the font size."""
- return self.__size
+ return float(self.__props.size[0])
 
+ def get_file(self):
+ return self.__props.file
+
+ def get_fontconfig_pattern(self):
+ return generate_fontconfig_pattern(self.__props.__dict__)
+ 
 def set_family(self, family):
 """
- Change the font family. Options are: serif, sans-serif, cursive,
- fantasy, or monospace.
+ Change the font family. May be either an alias (generic name
+ is CSS parlance), such as: serif, sans-serif, cursive,
+ fantasy, or monospace, or a real font name.
 """
- try:
- self.__family = rcParams['font.'+family]
- if isinstance(self.__family, str):
- self.__family = [self.__family]
- except KeyError:
- raise KeyError, '%s - use serif, sans-serif, cursive, fantasy, or monospace.' % family
-
- def set_name(self, names):
- """
- Add one or more font names to the font family list. If the
- font name is already in the list, then the font is given a higher
- priority in the font family list. To change the font family, use the
- set_family() method.
- """
-
- msg = "Font name '%s' is a font family. It is being deleted from the list."
- font_family = ['serif', 'sans-serif', 'cursive', 'fantasy',
- 'monospace']
-
- if isinstance(names, str):
- names = [names]
-
- # Remove family names from list of font names.
- for name in names[:]:
- if name.lower() in font_family:
- verbose.report( msg % name)
- while name in names:
- names.remove(name.lower())
-
- # Remove font names from family list.
- for name in names:
- while name in self.__family:
- self.__family.remove(name)
-
- self.__family = names + self.__family
-
+ if family is None:
+ self.__props.__dict__.pop('family', None)
+ else:
+ self.__props.family = family
+ 
 def set_style(self, style):
 """Set the font style. Values are: normal, italic or oblique."""
- self.__style = style
+ if style is None:
+ self.__props.__dict__.pop('style', None)
+ else:
+ if style not in ('normal', 'italic', 'oblique'):
+ raise ValueError("style must be normal, italic or oblique")
+ self.__props.slant = style
 
 def set_variant(self, variant):
 """Set the font variant. Values are: normal or small-caps."""
- self.__variant = variant
+ if variant is None:
+ self.__props.__dict__.pop('variant', None)
+ else:
+ if variant not in ('normal', 'small-caps'):
+ raise ValueError("variant must be normal or small-caps")
+ self.__props.variant = variant
 
 def set_weight(self, weight):
 """
 Set the font weight. See the FontProperties class for a
 a list of possible values.
 """
- self.__weight = weight
+ if weight is None:
+ self.__props.__dict__.pop('weight', None)
+ else:
+ if (weight not in weight_dict and
+ weight not in weight_dict.keys()):
+ raise ValueError("weight is invalid")
+ self.__props.weight = weight
 
 def set_stretch(self, stretch):
 """
 Set the font stretch or width. Options are: normal, narrow,
 condensed, or wide.
 """
- self.__stretch = stretch
+ if stretch is None:
+ self.__props.__dict__.pop('stretch', None)
+ else:
+ self.__props.stretch = stretch
 
 def set_size(self, size):
 """Set the font size."""
- self.__size = size
-
- def get_size_in_points(self, parent_size=None):
- """
- Return the size property as a numeric value. String values
- are converted to their corresponding numeric value.
- """
- if self.__size in font_scalings.keys():
- size = fontManager.get_default_size()*font_scalings[self.__size]
- elif self.__size == 'larger':
- size = self.__parent_size*1.2
- elif self.__size == 'smaller':
- size = self.__parent_size/1.2
+ if size is None:
+ self.__props.__dict__.pop('size', None)
 else:
- size = self.__size
- return float(size)
+ if is_string_like(size):
+ parent_size = fontManager.get_default_size()
+ scaling = font_scalings.get(size)
+ if scaling is not None:
+ size = parent_size * scaling
+ else:
+ size = parent_size
+ if isinstance(size, (int, float)):
+ size = [size]
+ self.__props.size = size
 
+ def set_file(self, file):
+ self.__props.file = file
+
+ get_size_in_points = get_size
+
+ def set_fontconfig_pattern(self, pattern):
+ self.__props.__dict__ = self._parse_fontconfig_pattern(pattern)
+ 
 def copy(self):
 """Return a deep copy of self"""
- return FontProperties(self.__family,
- self.__style,
- self.__variant,
- self.__weight,
- self.__stretch,
- self.__size)
+ return FontProperties(_init = self.__props.__dict__)
 
 def ttfdict_to_fnames(d):
 'flatten a ttfdict to all the filenames it contains'
@@ -905,8 +917,10 @@
 documentation for a description of the font finding algorithm.
 """
 debug = False
- if prop.fname is not None:
- fname = prop.fname
+ if is_string_like(prop):
+ prop = FontProperties(prop)
+ fname = prop.get_file()
+ if fname is not None:
 verbose.report('findfont returning %s'%fname, 'debug')
 return fname
 
@@ -957,6 +971,8 @@
 
 if not font.has_key(weight):
 setWeights(font)
+ if not font.has_key(weight):
+ return None
 font = font[weight]
 
 if font.has_key(stretch):
@@ -981,16 +997,19 @@
 if fname is None:
 verbose.report('\tfindfont failed %(name)s, %(style)s, %(variant)s %(weight)s, %(stretch)s'%locals(), 'debug')
 else:
- fontkey = FontKey(original_name, style, variant, weight, stretch, size)
+ fontkey = FontKey(",".join(prop.get_family()), style, variant, weight, stretch, size)
 add_filename(fontdict, fontkey, fname)
 verbose.report('\tfindfont found %(name)s, %(style)s, %(variant)s %(weight)s, %(stretch)s, %(size)s'%locals(), 'debug')
 verbose.report('findfont returning %s'%fname, 'debug')
 return fname
 
- font_family_aliases = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace']
+ font_family_aliases = Set(['serif', 'sans-serif', 'cursive',
+ 'fantasy', 'monospace', 'sans'])
 
 for name in prop.get_family():
 if name in font_family_aliases:
+ if name == 'sans':
+ name = 'sans-serif'
 for name2 in rcParams['font.' + name]:
 fname = lookup_name(name2)
 if fname:
@@ -1001,9 +1020,9 @@
 break
 
 if not fname:
- fontkey = FontKey(original_name, style, variant, weight, stretch, size)
+ fontkey = FontKey(",".join(prop.get_family()), style, variant, weight, stretch, size)
 add_filename(fontdict, fontkey, self.defaultFont)
- verbose.report('Could not match %s, %s, %s. Returning %s' % (name, style, variant, self.defaultFont))
+ verbose.report('Could not match %s, %s, %s. Returning %s' % (name, style, weight, self.defaultFont))
 return self.defaultFont
 return fname
 
Added: trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -0,0 +1,169 @@
+"""
+A module for parsing a fontconfig pattern.
+
+This class is defined here because it must be available in:
+ - The old-style config framework (rcsetup.py)
+ - The traits-based config framework (mpltraits.py)
+ - The font manager (font_manager.py)
+
+It probably logically belongs in font_manager.py, but
+placing it in any of these places would have created cyclical
+dependency problems, or an undesired dependency on traits even
+when the traits-based config framework is not used.
+
+See here for a rough specification of these patterns:
+http://www.fontconfig.org/fontconfig-user.html
+
+Author : Michael Droettboom <md...@st...>
+License : matplotlib license (PSF compatible)
+"""
+import re
+from matplotlib.pyparsing import Literal, OneOrMore, ZeroOrMore, \
+ Optional, Regex, StringEnd, ParseException
+
+family_punc = r'\\\-:,'
+family_unescape = re.compile(r'\\([%s])' % family_punc).sub
+family_escape = re.compile(r'([%s])' % family_punc).sub
+
+value_punc = r'\\=_:,'
+value_unescape = re.compile(r'\\([%s])' % value_punc).sub
+value_escape = re.compile(r'([%s])' % value_punc).sub
+
+class FontconfigPatternParser:
+ """A simple pyparsing-based parser for fontconfig-style patterns.
+
+ See here for a rough specification of these patterns:
+ http://www.fontconfig.org/fontconfig-user.html
+ """
+ 
+
+ _constants = {
+ 'thin' : ('weight', 'light'),
+ 'extralight' : ('weight', 'light'),
+ 'ultralight' : ('weight', 'light'),
+ 'light' : ('weight', 'light'),
+ 'book' : ('weight', 'book'),
+ 'regular' : ('weight', 'regular'),
+ 'normal' : ('weight', 'normal'),
+ 'medium' : ('weight', 'medium'),
+ 'demibold' : ('weight', 'demibold'),
+ 'semibold' : ('weight', 'semibold'),
+ 'bold' : ('weight', 'bold'),
+ 'extrabold' : ('weight', 'extra bold'),
+ 'black' : ('weight', 'black'),
+ 'heavy' : ('weight', 'heavy'),
+ 'roman' : ('slant', 'normal'),
+ 'italic' : ('slant', 'italic'),
+ 'oblique' : ('slant', 'oblique'),
+ 'ultracondensed' : ('width', 'ultra-condensed'),
+ 'extracondensed' : ('width', 'extra-condensed'),
+ 'condensed' : ('width', 'condensed'),
+ 'semicondensed' : ('width', 'semi-condensed'),
+ 'expanded' : ('width', 'expanded'),
+ 'extraexpanded' : ('width', 'extra-expanded'),
+ 'ultraexpanded' : ('width', 'ultra-expanded')
+ }
+ 
+ def __init__(self):
+ family = Regex(r'([^%s]|(\\[%s]))*' %
+ (family_punc, family_punc)) \
+ .setParseAction(self._family)
+ size = Regex(r'[0-9.]+') \
+ .setParseAction(self._size)
+ name = Regex(r'[a-z]+') \
+ .setParseAction(self._name)
+ value = Regex(r'([^%s]|(\\[%s]))*' %
+ (value_punc, value_punc)) \
+ .setParseAction(self._value)
+
+ families =(family
+ + ZeroOrMore(
+ Literal(',')
+ + family) 
+ ).setParseAction(self._families)
+
+ point_sizes =(size
+ + ZeroOrMore(
+ Literal(',')
+ + size)
+ ).setParseAction(self._point_sizes)
+
+ property =( (name
+ + Literal('=')
+ + value)
+ | name
+ ).setParseAction(self._property)
+
+ pattern =(Optional(
+ families)
+ + Optional(
+ Literal('-')
+ + point_sizes)
+ + ZeroOrMore(
+ Literal(':')
+ + property)
+ + StringEnd()
+ )
+
+ self._parser = pattern
+ self.ParseException = ParseException
+
+ def parse(self, pattern):
+ props = self._properties = {}
+ try:
+ self._parser.parseString(pattern)
+ except self.ParseException, e:
+ raise ValueError("Could not parse font string: '%s'\n%s" % (pattern, e))
+ 
+ self._properties = None
+ return props
+ 
+ def _family(self, s, loc, tokens):
+ return [family_unescape(r'1円', tokens[0])]
+
+ def _size(self, s, loc, tokens):
+ return [float(tokens[0])]
+
+ def _name(self, s, loc, tokens):
+ return [tokens[0]]
+
+ def _value(self, s, loc, tokens):
+ return [value_unescape(r'1円', tokens[0])]
+
+ def _families(self, s, loc, tokens):
+ self._properties['family'] = tokens
+ return []
+
+ def _point_sizes(self, s, loc, tokens):
+ self._properties['size'] = tokens
+ return []
+ 
+ def _property(self, s, loc, tokens):
+ if len(tokens) == 1:
+ if tokens[0] in self._constants:
+ key, val = self._constants[tokens[0]]
+ elif len(tokens) == 3:
+ key, op, val = tokens
+ self._properties[key] = val
+ return []
+
+parse_fontconfig_pattern = FontconfigPatternParser().parse
+
+def generate_fontconfig_pattern(d):
+ """Given a dictionary of key/value pairs, generates a fontconfig pattern
+ string."""
+ props = []
+ families = ''
+ size = ''
+ for key, val in d.items():
+ if key == 'family':
+ families = [family_escape(r'\\1円', name) for name in val]
+ families = ','.join(families)
+ elif key == 'size':
+ size = '-' + ','.join([str(x) for x in val])
+ elif val is not None:
+ val = value_escape(r'\\1円', str(val))
+ props.append(":%s=%s" % (key, val))
+ props = ''.join(props)
+
+ return ''.join([families, size, props])
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -9,6 +9,7 @@
 """
 
 import os
+from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 
 class ValidateInStrings:
 def __init__(self, key, valid, ignorecase=False):
@@ -197,64 +198,10 @@
 return float(s)
 except ValueError:
 raise ValueError('not a valid font size')
-
-class FontPropertiesProxy(object):
- # In order to build a FontProperties object, various rcParams must
- # already be known in order to set default values. That means a
- # FontProperties object can not be created from a config file,
- # since it depends on other values in the same config file. This
- # proxy class is used as a temporary storage area for the settings
- # in the config file, and the full FontProperties class is created
- # only when the class is first used. It is defined here rather than
- # in font_manager.py to avoid a cyclical import.
- def __init__(self,
- family = None,
- style = None,
- variant= None,
- weight = None,
- stretch= None,
- size = None,
- fname = None, # if this is set, it's a hardcoded filename to use
- ):
- self.__family = family
- self.__style = style
- self.__variant = variant
- self.__weight = weight
- self.__stretch = stretch
- self.__size = size
- self.__fname = fname
-
- self.__child = None
-
- def __get_child(self):
- if self.__child is None:
- from font_manager import FontProperties
- self.__child = FontProperties(
- family = self.__family,
- style = self.__style,
- variant = self.__variant,
- weight = self.__weight,
- stretch = self.__stretch,
- size = self.__size,
- fname = self.__fname)
- return self.__child
-
- def __getattr__(self, attr):
- return getattr(self.__get_child(), attr)
 
 def validate_font_properties(s):
- parsed = False
- try:
- prop = eval(u'FontProperties(%s)' % s,
- {}, {'FontProperties': FontPropertiesProxy})
- except:
- pass
- else:
- parsed = isinstance(prop, FontPropertiesProxy)
- if not parsed:
- raise ValueError(
- 'Mathtext font specifier must be a set of arguments to the FontProperty constructor.')
- return prop
+ parse_fontconfig_pattern(s)
+ return s
 
 validate_markup = ValidateInStrings(
 'markup', 
@@ -418,12 +365,12 @@
 'text.fontsize' : ['medium', validate_fontsize],
 'text.markup' : ['plain', validate_markup],
 
- 'mathtext.cal' : [FontPropertiesProxy(['cursive']), validate_font_properties],
- 'mathtext.rm' : [FontPropertiesProxy(['serif']), validate_font_properties],
- 'mathtext.tt' : [FontPropertiesProxy(['monospace']), validate_font_properties],
- 'mathtext.it' : [FontPropertiesProxy(['serif'], style='oblique'), validate_font_properties],
- 'mathtext.bf' : [FontPropertiesProxy(['serif'], weight='bold'), validate_font_properties],
- 'mathtext.sf' : [FontPropertiesProxy(['sans-serif']), validate_font_properties],
+ 'mathtext.cal' : ['cursive', validate_font_properties],
+ 'mathtext.rm' : ['serif', validate_font_properties],
+ 'mathtext.tt' : ['monospace', validate_font_properties],
+ 'mathtext.it' : ['serif:italic', validate_font_properties],
+ 'mathtext.bf' : ['serif:bold', validate_font_properties],
+ 'mathtext.sf' : ['sans\-serif', validate_font_properties],
 'mathtext.use_cm' : [True, validate_bool],
 'mathtext.fallback_to_cm' : [True, validate_bool],
 
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py	2007年08月26日 06:56:07 UTC (rev 3737)
+++ trunk/matplotlib/lib/matplotlib/text.py	2007年08月27日 15:42:44 UTC (rev 3738)
@@ -162,6 +162,7 @@
 
 if color is None: color = rcParams['text.color']
 if fontproperties is None: fontproperties=FontProperties()
+ elif is_string_like(fontproperties): fontproperties=FontProperties(fontproperties)
 
 self.set_text(text)
 self.set_color(color)
@@ -649,11 +650,11 @@
 
 ACCEPTS: string eg, ['Sans' | 'Courier' | 'Helvetica' ...]
 """
- self._fontproperties.set_name(fontname)
+ self._fontproperties.set_family(fontname)
 
 def set_fontname(self, fontname):
 'alias for set_name'
- self.set_name(fontname)
+ self.set_family(fontname)
 
 def set_style(self, fontstyle):
 """
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年08月27日 14:37:30
Revision: 3737
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3737&view=rev
Author: efiring
Date: 2007年08月25日 23:56:07 -0700 (2007年8月25日)
Log Message:
-----------
Added step plot based on patch by Manuel Metz
Modified Paths:
--------------
 trunk/matplotlib/boilerplate.py
 trunk/matplotlib/examples/masked_demo.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/pylab.py
Added Paths:
-----------
 trunk/matplotlib/examples/step_demo.py
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py	2007年08月24日 18:17:51 UTC (rev 3736)
+++ trunk/matplotlib/boilerplate.py	2007年08月26日 06:56:07 UTC (rev 3737)
@@ -80,6 +80,7 @@
 'specgram',
 'spy',
 'stem',
+ 'step',
 'vlines',
 'quiver',
 'quiverkey',
Modified: trunk/matplotlib/examples/masked_demo.py
===================================================================
--- trunk/matplotlib/examples/masked_demo.py	2007年08月24日 18:17:51 UTC (rev 3736)
+++ trunk/matplotlib/examples/masked_demo.py	2007年08月26日 06:56:07 UTC (rev 3737)
@@ -6,15 +6,15 @@
 break the line at the data gaps.
 '''
 
-import matplotlib.numerix.ma as M
+import matplotlib.numerix.npyma as ma
 from pylab import *
 
-x = M.arange(0, 2*pi, 0.02)
-y = M.sin(x)
+x = ma.arange(0, 2*pi, 0.02)
+y = ma.sin(x)
 y1 = sin(2*x)
 y2 = sin(3*x)
-ym1 = M.masked_where(y1 > 0.5, y1)
-ym2 = M.masked_where(y2 < -0.5, y2)
+ym1 = ma.masked_where(y1 > 0.5, y1)
+ym2 = ma.masked_where(y2 < -0.5, y2)
 
 lines = plot(x, y, 'r', x, ym1, 'g', x, ym2, 'bo')
 setp(lines[0], linewidth = 4)
Added: trunk/matplotlib/examples/step_demo.py
===================================================================
--- trunk/matplotlib/examples/step_demo.py	 (rev 0)
+++ trunk/matplotlib/examples/step_demo.py	2007年08月26日 06:56:07 UTC (rev 3737)
@@ -0,0 +1,24 @@
+import numpy as npy
+from pylab import *
+
+x = npy.arange(1, 7, 0.4)
+y0 = npy.sin(x)
+y = y0.copy() + 2.5
+
+step(x, y, label='pre (default)')
+
+y -= 0.5
+step(x, y, where='mid', label='mid')
+
+y -= 0.5
+step(x, y, where='post', label='post')
+
+y = npy.ma.masked_where((y0>-0.15)&(y0<0.15), y - 0.5)
+step(x,y, label='masked (pre)')
+
+legend()
+
+xlim(0, 7)
+ylim(-0.5, 4)
+
+show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年08月24日 18:17:51 UTC (rev 3736)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年08月26日 06:56:07 UTC (rev 3737)
@@ -2964,7 +2964,59 @@
 
 #### Specialized plotting
 
+ def step(self, x, y, *args, **kwargs):
+ '''
+ step(x, y, *args, **kwargs)
 
+ x and y must be 1-D sequences, and it is assumed, but not checked,
+ that x is uniformly increasing.
+
+ Make a step plot. The args and keyword args to step are the same
+ as the args to plot. See help plot for more info.
+
+ Additional keyword args for step:
+
+ * where: can be 'pre', 'post' or 'mid'; if 'pre', the
+ interval from x[i] to x[i+1] has level y[i];
+ if 'post', that interval has level y[i+1];
+ and if 'mid', the jumps in y occur half-way
+ between the x-values. Default is 'pre'.
+ '''
+
+ where = kwargs.pop('where', 'pre')
+
+ if not cbook.iterable(x):
+ x = ma.array([x], dtype=npy.float_)
+ if not cbook.iterable(y):
+ y = ma.array([y], dtype=npy.float_)
+
+ if where=='pre':
+ x2 = ma.zeros((2*len(x)-1,), npy.float_)
+ y2 = ma.zeros((2*len(y)-1,), npy.float_)
+
+ x2[0::2], x2[1::2] = x, x[:-1]
+ y2[0::2], y2[1:-1:2] = y, y[1:]
+
+ elif where=='post':
+ x2 = ma.zeros((2*len(x)-1,), npy.float_)
+ y2 = ma.zeros((2*len(y)-1,), npy.float_)
+
+ x2[::2], x2[1:-1:2] = x, x[1:]
+ y2[0::2], y2[1::2] = y, y[:-1]
+
+ elif where=='mid':
+ x2 = ma.zeros((2*len(x),), npy.float_)
+ y2 = ma.zeros((2*len(y),), npy.float_)
+
+ x2[1:-1:2] = 0.5*(x[:-1]+x[1:])
+ x2[2::2] = 0.5*(x[:-1]+x[1:])
+ x2[0], x2[-1] = x[0], x[-1]
+
+ y2[0::2], y2[1::2] = y, y
+
+ return self.plot(x2, y2, *args, **kwargs)
+
+
 def bar(self, left, height, width=0.8, bottom=None,
 color=None, edgecolor=None, linewidth=None,
 yerr=None, xerr=None, ecolor=None, capsize=3,
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2007年08月24日 18:17:51 UTC (rev 3736)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2007年08月26日 06:56:07 UTC (rev 3737)
@@ -1555,7 +1555,7 @@
 def acorr(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1576,7 +1576,7 @@
 def arrow(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1597,7 +1597,7 @@
 def axhline(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1618,7 +1618,7 @@
 def axhspan(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1639,7 +1639,7 @@
 def axvline(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1660,7 +1660,7 @@
 def axvspan(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1681,7 +1681,7 @@
 def bar(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1702,7 +1702,7 @@
 def barh(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1723,7 +1723,7 @@
 def broken_barh(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1744,7 +1744,7 @@
 def boxplot(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1765,7 +1765,7 @@
 def cohere(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1786,7 +1786,7 @@
 def clabel(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1807,7 +1807,7 @@
 def contour(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1828,7 +1828,7 @@
 def contourf(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1849,7 +1849,7 @@
 def csd(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1870,7 +1870,7 @@
 def errorbar(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1891,7 +1891,7 @@
 def fill(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1912,7 +1912,7 @@
 def hist(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1933,7 +1933,7 @@
 def hlines(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1954,7 +1954,7 @@
 def imshow(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1975,7 +1975,7 @@
 def loglog(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -1996,7 +1996,7 @@
 def pcolor(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2017,7 +2017,7 @@
 def pcolormesh(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2038,7 +2038,7 @@
 def pie(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2059,7 +2059,7 @@
 def plot(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2080,7 +2080,7 @@
 def plot_date(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2101,7 +2101,7 @@
 def psd(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2122,7 +2122,7 @@
 def scatter(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2143,7 +2143,7 @@
 def semilogx(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2164,7 +2164,7 @@
 def semilogy(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2185,7 +2185,7 @@
 def specgram(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2206,7 +2206,7 @@
 def spy(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2227,7 +2227,7 @@
 def stem(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2245,10 +2245,31 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
+def step(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().step(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+
+ hold(b)
+ return ret
+if Axes.step.__doc__ is not None:
+ step.__doc__ = dedent(Axes.step.__doc__) + """
+Addition kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
 def vlines(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2269,7 +2290,7 @@
 def quiver(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2290,7 +2311,7 @@
 def quiverkey(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2311,7 +2332,7 @@
 def xcorr(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
- h = popd(kwargs, 'hold', None)
+ h = kwargs.pop('hold', None)
 if h is not None:
 hold(h)
 try:
@@ -2582,3 +2603,4 @@
 draw_if_interactive()
 
 
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3736
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3736&view=rev
Author: jouni
Date: 2007年08月24日 11:17:51 -0700 (2007年8月24日)
Log Message:
-----------
Support get_image_magnification in pdf backend
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年08月23日 18:02:03 UTC (rev 3735)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年08月24日 18:17:51 UTC (rev 3736)
@@ -1021,7 +1021,7 @@
 
 class RendererPdf(RendererBase):
 
- def __init__(self, file):
+ def __init__(self, file, dpi):
 RendererBase.__init__(self)
 self.file = file
 self.gc = self.new_gc()
@@ -1033,6 +1033,7 @@
 else:
 self.encode_string = self.encode_string_type42
 self.mathtext_parser = MathTextParser("Pdf")
+ self.image_magnification = dpi/72.0
 
 def finalize(self):
 self.gc.finalize()
@@ -1120,6 +1121,9 @@
 
 self.file.output(self.gc.close_and_paint())
 
+ def get_image_magnification(self):
+ return self.image_magnification
+
 def draw_image(self, x, y, im, bbox):
 #print >>sys.stderr, "draw_image called"
 
@@ -1128,6 +1132,7 @@
 self.check_gc(gc)
 
 h, w = im.get_size_out()
+ h, w = h/self.image_magnification, w/self.image_magnification
 imob = self.file.imageObject(im)
 self.file.output(Op.gsave, w, 0, 0, h, x, y, Op.concat_matrix,
 imob, Op.use_xobject, Op.grestore)
@@ -1735,7 +1740,7 @@
 filename += '.pdf'
 
 file = PdfFile(width, height, filename)
- renderer = RendererPdf(file)
+ renderer = RendererPdf(file, dpi)
 self.figure.draw(renderer)
 renderer.finalize()
 file.close()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月23日 18:02:04
Revision: 3735
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3735&view=rev
Author: mdboom
Date: 2007年08月23日 11:02:03 -0700 (2007年8月23日)
Log Message:
-----------
There's no need to link ttconv with CXX (it hasn't used it for
sometime, but I forgot to remove it from the build.)
Modified Paths:
--------------
 trunk/matplotlib/setupext.py
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py	2007年08月23日 18:00:42 UTC (rev 3734)
+++ trunk/matplotlib/setupext.py	2007年08月23日 18:02:03 UTC (rev 3735)
@@ -779,8 +779,6 @@
 'ttconv/pprdrv_tt.cpp',
 'ttconv/pprdrv_tt2.cpp',
 'ttconv/ttutil.cpp']
- deps.extend(glob.glob('CXX/*.cxx'))
- deps.extend(glob.glob('CXX/*.c'))
 
 module = Extension('matplotlib.ttconv', deps)
 add_base_flags(module)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月23日 18:00:44
Revision: 3734
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3734&view=rev
Author: mdboom
Date: 2007年08月23日 11:00:42 -0700 (2007年8月23日)
Log Message:
-----------
Update PyCXX to latest upstream stable version (5.4.0)
Modified Paths:
--------------
 trunk/matplotlib/CXX/Config.hxx
 trunk/matplotlib/CXX/Exception.hxx
 trunk/matplotlib/CXX/Extensions.hxx
 trunk/matplotlib/CXX/IndirectPythonInterface.cxx
 trunk/matplotlib/CXX/IndirectPythonInterface.hxx
 trunk/matplotlib/CXX/Objects.hxx
 trunk/matplotlib/CXX/Version.hxx
 trunk/matplotlib/CXX/cxx_extensions.cxx
 trunk/matplotlib/CXX/cxxextensions.c
 trunk/matplotlib/CXX/cxxsupport.cxx
Added Paths:
-----------
 trunk/matplotlib/CXX/WrapPython.h
Modified: trunk/matplotlib/CXX/Config.hxx
===================================================================
--- trunk/matplotlib/CXX/Config.hxx	2007年08月23日 17:59:21 UTC (rev 3733)
+++ trunk/matplotlib/CXX/Config.hxx	2007年08月23日 18:00:42 UTC (rev 3734)
@@ -1,3 +1,40 @@
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 1998 - 2007, The Regents of the University of California
+// Produced at the Lawrence Livermore National Laboratory
+// All rights reserved.
+//
+// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
+// full copyright notice is contained in the file COPYRIGHT located at the root
+// of the PyCXX distribution.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the disclaimer below.
+// - Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the disclaimer (as noted below) in the
+// documentation and/or materials provided with the distribution.
+// - Neither the name of the UC/LLNL nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
+// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+//
+//-----------------------------------------------------------------------------
+
 #ifndef __PyCXX_config_hh__
 #define __PyCXX_config_hh__
 
@@ -70,5 +107,12 @@
 # define TEMPLATE_TYPENAME class
 #endif
 
+// before 2.5 Py_ssize_t was missing
+#ifndef PY_MAJOR_VERSION
+#error not defined PY_MAJOR_VERSION
+#endif
+#if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5)
+typedef int Py_ssize_t;
+#endif
 
 #endif // __PyCXX_config_hh__
Modified: trunk/matplotlib/CXX/Exception.hxx
===================================================================
--- trunk/matplotlib/CXX/Exception.hxx	2007年08月23日 17:59:21 UTC (rev 3733)
+++ trunk/matplotlib/CXX/Exception.hxx	2007年08月23日 18:00:42 UTC (rev 3734)
@@ -1,12 +1,44 @@
-//----------------------------------*-C++-*----------------------------------//
-// Copyright 1998 The Regents of the University of California. 
-// All rights reserved. See LEGAL.LLNL for full text and disclaimer.
-//---------------------------------------------------------------------------//
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 1998 - 2007, The Regents of the University of California
+// Produced at the Lawrence Livermore National Laboratory
+// All rights reserved.
+//
+// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
+// full copyright notice is contained in the file COPYRIGHT located at the root
+// of the PyCXX distribution.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the disclaimer below.
+// - Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the disclaimer (as noted below) in the
+// documentation and/or materials provided with the distribution.
+// - Neither the name of the UC/LLNL nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
+// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+//
+//-----------------------------------------------------------------------------
 
 #ifndef __CXX_Exception_h
 #define __CXX_Exception_h
 
-#include "Python.h"
+#include "CXX/WrapPython.h"
 #include "CXX/Version.hxx"
 #include "CXX/Config.hxx"
 #include "CXX/IndirectPythonInterface.hxx"
@@ -16,202 +48,202 @@
 
 // This mimics the Python structure, in order to minimize confusion
 namespace Py
-	{
-	class ExtensionExceptionType;
+{
+ class ExtensionExceptionType;
 
-	class Object;
+ class Object;
 
-	class Exception
-		{
-	public:
-		Exception( ExtensionExceptionType &exception, const std::string& reason );
-		Exception( ExtensionExceptionType &exception, Object &reason );
+ class Exception
+ {
+ public:
+ Exception( ExtensionExceptionType &exception, const std::string& reason );
+ Exception( ExtensionExceptionType &exception, Object &reason );
 
-		explicit Exception ()
-			{}
-		
-		Exception (const std::string& reason)
-			{
-			PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str());
-			}
-		
-		Exception (PyObject* exception, const std::string& reason)
-			{
-			PyErr_SetString (exception, reason.c_str());
-			}
-		
-		Exception (PyObject* exception, Object &reason);		
+ explicit Exception ()
+ {}
+ 
+ Exception (const std::string& reason)
+ {
+ PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str());
+ }
+ 
+ Exception (PyObject* exception, const std::string& reason)
+ {
+ PyErr_SetString (exception, reason.c_str());
+ }
+ 
+ Exception (PyObject* exception, Object &reason); 
 
-		void clear() // clear the error
-		// technically but not philosophically const
-			{
-			PyErr_Clear();
-			}
-		};
-	
-	
-	// Abstract
-	class StandardError: public Exception
-		{
-	protected: 
-		explicit StandardError()
-			{}
-		};
-	
-	class LookupError: public StandardError
-		{
-	protected: 
-		explicit LookupError()
-			{}
-		};
-	
-	class ArithmeticError: public StandardError
-		{
-	protected: 
-		explicit ArithmeticError()
-			{}
-		};
-	
-	class EnvironmentError: public StandardError
-		{
-	protected: 
-		explicit EnvironmentError()
-			{}
-		};
-	
-	// Concrete
-	
-	class TypeError: public StandardError
-		{
-	public:
-		TypeError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_TypeError(),reason.c_str());
-			}
-		};
-	
-	class IndexError: public LookupError
-		{
-	public:
-		IndexError (const std::string& reason)
-			: LookupError()
-			{
-			PyErr_SetString (Py::_Exc_IndexError(), reason.c_str());
-			}
-		};
-	
-	class AttributeError: public StandardError
-		{
-	public:
-		AttributeError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_AttributeError(), reason.c_str());
-			}		
-		};
-	
-	class NameError: public StandardError
-		{
-	public:
-		NameError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_NameError(), reason.c_str());
-			}
-		};
-	
-	class RuntimeError: public StandardError
-		{
-	public:
-		RuntimeError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str());
-			}
-		};
-	
-	class SystemError: public StandardError
-		{
-	public:
-		SystemError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_SystemError(),reason.c_str());
-			}
-		};
-	
-	class KeyError: public LookupError
-		{
-	public:
-		KeyError (const std::string& reason)
-			: LookupError()
-			{
-			PyErr_SetString (Py::_Exc_KeyError(),reason.c_str());
-			}
-		};
-	
-	
-	class ValueError: public StandardError
-		{
-	public:
-		ValueError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_ValueError(), reason.c_str());
-			}
-		};
-	
-	class OverflowError: public ArithmeticError
-		{
-	public:
-		OverflowError (const std::string& reason)
-			: ArithmeticError()
-			{
-			PyErr_SetString (Py::_Exc_OverflowError(), reason.c_str());
-			}		
-		};
-	
-	class ZeroDivisionError: public ArithmeticError
-		{
-	public:
-		ZeroDivisionError (const std::string& reason)
-			: ArithmeticError() 
-			{
-			PyErr_SetString (Py::_Exc_ZeroDivisionError(), reason.c_str());
-			}
-		};
-	
-	class FloatingPointError: public ArithmeticError
-		{
-	public:
-		FloatingPointError (const std::string& reason)
-			: ArithmeticError() 
-			{
-			PyErr_SetString (Py::_Exc_FloatingPointError(), reason.c_str());
-			}
-		};
-	
-	class MemoryError: public StandardError
-		{
-	public:
-		MemoryError (const std::string& reason)
-			: StandardError()
-			{
-			PyErr_SetString (Py::_Exc_MemoryError(), reason.c_str());
-			}	
-		};
-	
-	class SystemExit: public StandardError
-		{
-	public:
-		SystemExit (const std::string& reason)
-			: StandardError() 
-			{
-			PyErr_SetString (Py::_Exc_SystemExit(),reason.c_str());
-			}
-		};
+ void clear() // clear the error
+ // technically but not philosophically const
+ {
+ PyErr_Clear();
+ }
+ };
+ 
+ 
+ // Abstract
+ class StandardError: public Exception
+ {
+ protected: 
+ explicit StandardError()
+ {}
+ };
+ 
+ class LookupError: public StandardError
+ {
+ protected: 
+ explicit LookupError()
+ {}
+ };
+ 
+ class ArithmeticError: public StandardError
+ {
+ protected: 
+ explicit ArithmeticError()
+ {}
+ };
+ 
+ class EnvironmentError: public StandardError
+ {
+ protected: 
+ explicit EnvironmentError()
+ {}
+ };
+ 
+ // Concrete
+ 
+ class TypeError: public StandardError
+ {
+ public:
+ TypeError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_TypeError(),reason.c_str());
+ }
+ };
+ 
+ class IndexError: public LookupError
+ {
+ public:
+ IndexError (const std::string& reason)
+ : LookupError()
+ {
+ PyErr_SetString (Py::_Exc_IndexError(), reason.c_str());
+ }
+ };
+ 
+ class AttributeError: public StandardError
+ {
+ public:
+ AttributeError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_AttributeError(), reason.c_str());
+ } 
+ };
+ 
+ class NameError: public StandardError
+ {
+ public:
+ NameError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_NameError(), reason.c_str());
+ }
+ };
+ 
+ class RuntimeError: public StandardError
+ {
+ public:
+ RuntimeError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str());
+ }
+ };
+ 
+ class SystemError: public StandardError
+ {
+ public:
+ SystemError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_SystemError(),reason.c_str());
+ }
+ };
+ 
+ class KeyError: public LookupError
+ {
+ public:
+ KeyError (const std::string& reason)
+ : LookupError()
+ {
+ PyErr_SetString (Py::_Exc_KeyError(),reason.c_str());
+ }
+ };
+ 
+ 
+ class ValueError: public StandardError
+ {
+ public:
+ ValueError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_ValueError(), reason.c_str());
+ }
+ };
+ 
+ class OverflowError: public ArithmeticError
+ {
+ public:
+ OverflowError (const std::string& reason)
+ : ArithmeticError()
+ {
+ PyErr_SetString (Py::_Exc_OverflowError(), reason.c_str());
+ } 
+ };
+ 
+ class ZeroDivisionError: public ArithmeticError
+ {
+ public:
+ ZeroDivisionError (const std::string& reason)
+ : ArithmeticError() 
+ {
+ PyErr_SetString (Py::_Exc_ZeroDivisionError(), reason.c_str());
+ }
+ };
+ 
+ class FloatingPointError: public ArithmeticError
+ {
+ public:
+ FloatingPointError (const std::string& reason)
+ : ArithmeticError() 
+ {
+ PyErr_SetString (Py::_Exc_FloatingPointError(), reason.c_str());
+ }
+ };
+ 
+ class MemoryError: public StandardError
+ {
+ public:
+ MemoryError (const std::string& reason)
+ : StandardError()
+ {
+ PyErr_SetString (Py::_Exc_MemoryError(), reason.c_str());
+ } 
+ };
+ 
+ class SystemExit: public StandardError
+ {
+ public:
+ SystemExit (const std::string& reason)
+ : StandardError() 
+ {
+ PyErr_SetString (Py::_Exc_SystemExit(),reason.c_str());
+ }
+ };
 
-	}// Py
+}// Py
 
 #endif
Modified: trunk/matplotlib/CXX/Extensions.hxx
===================================================================
--- trunk/matplotlib/CXX/Extensions.hxx	2007年08月23日 17:59:21 UTC (rev 3733)
+++ trunk/matplotlib/CXX/Extensions.hxx	2007年08月23日 18:00:42 UTC (rev 3734)
@@ -1,7 +1,39 @@
-//----------------------------------*-C++-*----------------------------------//
-// Copyright 1998 The Regents of the University of California. 
-// All rights reserved. See LEGAL.LLNL for full text and disclaimer.
-//---------------------------------------------------------------------------//
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 1998 - 2007, The Regents of the University of California
+// Produced at the Lawrence Livermore National Laboratory
+// All rights reserved.
+//
+// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
+// full copyright notice is contained in the file COPYRIGHT located at the root
+// of the PyCXX distribution.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the disclaimer below.
+// - Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the disclaimer (as noted below) in the
+// documentation and/or materials provided with the distribution.
+// - Neither the name of the UC/LLNL nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
+// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+//
+//-----------------------------------------------------------------------------
 
 #ifndef __CXX_Extensions__h
 #define __CXX_Extensions__h
@@ -13,749 +45,747 @@
 #pragma warning(disable: 4786)
 #endif
 
-
+#include "CXX/WrapPython.h"
 #include "CXX/Version.hxx"
 #include "CXX/Config.hxx"
 #include "CXX/Objects.hxx"
 
 extern "C"
-	{
-	extern PyObject py_object_initializer;
-	}
+{
+ extern PyObject py_object_initializer;
+}
 
 #include <vector>
 #include <map>
 
 namespace Py
-	{
-	class ExtensionModuleBase;
-	
-	// Make an Exception Type for use in raising custom exceptions
-	class ExtensionExceptionType : public Object
-		{
-	public:
-		ExtensionExceptionType();
-		virtual ~ExtensionExceptionType();
+{
+ class ExtensionModuleBase;
+ 
+ // Make an Exception Type for use in raising custom exceptions
+ class ExtensionExceptionType : public Object
+ {
+ public:
+ ExtensionExceptionType();
+ virtual ~ExtensionExceptionType();
 
-		// call init to create the type
-		void init( ExtensionModuleBase &module, const std::string& name, ExtensionExceptionType &parent );
-		void init( ExtensionModuleBase &module, const std::string& name );
-		};
+ // call init to create the type
+ void init( ExtensionModuleBase &module, const std::string& name, ExtensionExceptionType &parent );
+ void init( ExtensionModuleBase &module, const std::string& name );
+ };
 
-	
-	class MethodTable 
-		{
-	public:
-		MethodTable();
-		virtual ~MethodTable();
-		
-		void add(const char* method_name, PyCFunction f, const char* doc="", int flag=1);
-		PyMethodDef* table();
-		
-	protected:
-		std::vector<PyMethodDef> t;	// accumulator of PyMethodDef's
-		PyMethodDef *mt;		// Actual method table produced when full
-		
-		static PyMethodDef method (const char* method_name, PyCFunction f, int flags = 1, const char* doc="");
-		
-	private:
-		//
-		// prevent the compiler generating these unwanted functions
-		//
-		MethodTable(const MethodTable& m);	//unimplemented
-		void operator=(const MethodTable& m);	//unimplemented
-		
-		}; // end class MethodTable
-	
-	extern "C"
-		{
-		typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args );
-		typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict );
-		};
-	
-	template<class T>
-	class MethodDefExt : public PyMethodDef
-		{
-	public:
-		typedef Object (T::*method_varargs_function_t)( const Tuple &args );
-		typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
-		
-		MethodDefExt
-		(
-		const char *_name,
-		method_varargs_function_t _function,
-		method_varargs_call_handler_t _handler,
-		const char *_doc
-		)
-			{
-			ext_meth_def.ml_name = const_cast<char *>(_name);
-			ext_meth_def.ml_meth = _handler;
-			ext_meth_def.ml_flags = METH_VARARGS;
-			ext_meth_def.ml_doc = const_cast<char *>(_doc);
-			
-			ext_varargs_function = _function;
-			ext_keyword_function = NULL;
-			}
-		
-		MethodDefExt
-		(
-		const char *_name,
-		method_keyword_function_t _function,
-		method_keyword_call_handler_t _handler,
-		const char *_doc
-		)
-			{
-			ext_meth_def.ml_name = const_cast<char *>(_name);
-			ext_meth_def.ml_meth = method_varargs_call_handler_t( _handler );
-			ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS;
-			ext_meth_def.ml_doc = const_cast<char *>(_doc);
-			
-			ext_varargs_function = NULL;
-			ext_keyword_function = _function;
-			}
-		
-		~MethodDefExt()
-			{}
-		
-		PyMethodDef ext_meth_def;
-		method_varargs_function_t ext_varargs_function;	
-		method_keyword_function_t ext_keyword_function;	
-		};
-	
-	class ExtensionModuleBase
-		{
-	public:
-		ExtensionModuleBase( const char *name );
-		virtual ~ExtensionModuleBase();
-		
-		Module module(void) const;		// only valid after initialize() has been called
-		Dict moduleDictionary(void) const;	// only valid after initialize() has been called
-		
-		virtual Object invoke_method_keyword( const std::string &_name, const Tuple &_args, const Dict &_keywords ) = 0;
-		virtual Object invoke_method_varargs( const std::string &_name, const Tuple &_args ) = 0;
-		
-		const std::string &name() const;
-		const std::string &fullName() const;
-	
-	protected:
-		// Initialize the module
-		void initialize( const char *module_doc );
-		
-		const std::string module_name;
-		const std::string full_module_name;
-		MethodTable method_table;
-		
-	private:
-		
-		//
-		// prevent the compiler generating these unwanted functions
-		//
-		ExtensionModuleBase( const ExtensionModuleBase & );	//unimplemented
-		void operator=( const ExtensionModuleBase & );		//unimplemented
-		
-		};
-	
-	extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
-	extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
-	extern "C" void do_not_dealloc( void * );
-	
-	
-	template<TEMPLATE_TYPENAME T>
-	class ExtensionModule : public ExtensionModuleBase
-		{
-	public:
-		ExtensionModule( const char *name )
-			: ExtensionModuleBase( name )
-			{}
-		virtual ~ExtensionModule()
-			{}
-		
-	protected:
-		typedef Object (T::*method_varargs_function_t)( const Tuple &args );
-		typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
-		typedef std::map<std::string,MethodDefExt<T> *> method_map_t;
-		
-		static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" )
-			{
-			method_map_t &mm = methods();
-			
-			MethodDefExt<T> *method_definition = new MethodDefExt<T>
-			(
-			name,
-			function,
-			method_varargs_call_handler,
-			doc
-			);
-			
-			mm[std::string( name )] = method_definition;
-			}
-		
-		static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" )
-			{
-			method_map_t &mm = methods();
-			
-			MethodDefExt<T> *method_definition = new MethodDefExt<T>
-			(
-			name,
-			function,
-			method_keyword_call_handler,
-			doc
-			);
-			
-			mm[std::string( name )] = method_definition;
-			}
+ 
+ class MethodTable 
+ {
+ public:
+ MethodTable();
+ virtual ~MethodTable();
+ 
+ void add(const char* method_name, PyCFunction f, const char* doc="", int flag=1);
+ PyMethodDef* table();
+ 
+ protected:
+ std::vector<PyMethodDef> t; // accumulator of PyMethodDef's
+ PyMethodDef *mt; // Actual method table produced when full
+ 
+ static PyMethodDef method (const char* method_name, PyCFunction f, int flags = 1, const char* doc="");
+ 
+ private:
+ //
+ // prevent the compiler generating these unwanted functions
+ //
+ MethodTable(const MethodTable& m); //unimplemented
+ void operator=(const MethodTable& m); //unimplemented
+ 
+ }; // end class MethodTable
+ 
+ extern "C"
+ {
+ typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args );
+ typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict );
+ };
+ 
+ template<class T>
+ class MethodDefExt : public PyMethodDef
+ {
+ public:
+ typedef Object (T::*method_varargs_function_t)( const Tuple &args );
+ typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
+ 
+ MethodDefExt
+ (
+ const char *_name,
+ method_varargs_function_t _function,
+ method_varargs_call_handler_t _handler,
+ const char *_doc
+ )
+ {
+ ext_meth_def.ml_name = const_cast<char *>(_name);
+ ext_meth_def.ml_meth = _handler;
+ ext_meth_def.ml_flags = METH_VARARGS;
+ ext_meth_def.ml_doc = const_cast<char *>(_doc);
+ 
+ ext_varargs_function = _function;
+ ext_keyword_function = NULL;
+ }
+ 
+ MethodDefExt
+ (
+ const char *_name,
+ method_keyword_function_t _function,
+ method_keyword_call_handler_t _handler,
+ const char *_doc
+ )
+ {
+ ext_meth_def.ml_name = const_cast<char *>(_name);
+ ext_meth_def.ml_meth = method_varargs_call_handler_t( _handler );
+ ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS;
+ ext_meth_def.ml_doc = const_cast<char *>(_doc);
+ 
+ ext_varargs_function = NULL;
+ ext_keyword_function = _function;
+ }
+ 
+ ~MethodDefExt()
+ {}
+ 
+ PyMethodDef ext_meth_def;
+ method_varargs_function_t ext_varargs_function; 
+ method_keyword_function_t ext_keyword_function; 
+ };
+ 
+ class ExtensionModuleBase
+ {
+ public:
+ ExtensionModuleBase( const char *name );
+ virtual ~ExtensionModuleBase();
+ 
+ Module module(void) const; // only valid after initialize() has been called
+ Dict moduleDictionary(void) const; // only valid after initialize() has been called
+ 
+ virtual Object invoke_method_keyword( const std::string &_name, const Tuple &_args, const Dict &_keywords ) = 0;
+ virtual Object invoke_method_varargs( const std::string &_name, const Tuple &_args ) = 0;
+ 
+ const std::string &name() const;
+ const std::string &fullName() const;
+ 
+ protected:
+ // Initialize the module
+ void initialize( const char *module_doc );
+ 
+ const std::string module_name;
+ const std::string full_module_name;
+ MethodTable method_table;
+ 
+ private:
+ 
+ //
+ // prevent the compiler generating these unwanted functions
+ //
+ ExtensionModuleBase( const ExtensionModuleBase & ); //unimplemented
+ void operator=( const ExtensionModuleBase & ); //unimplemented
+ 
+ };
+ 
+ extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
+ extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
+ extern "C" void do_not_dealloc( void * );
+ 
+ 
+ template<TEMPLATE_TYPENAME T>
+ class ExtensionModule : public ExtensionModuleBase
+ {
+ public:
+ ExtensionModule( const char *name )
+ : ExtensionModuleBase( name )
+ {}
+ virtual ~ExtensionModule()
+ {}
+ 
+ protected:
+ typedef Object (T::*method_varargs_function_t)( const Tuple &args );
+ typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
+ typedef std::map<std::string,MethodDefExt<T> *> method_map_t;
+ 
+ static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" )
+ {
+ method_map_t &mm = methods();
+ 
+ MethodDefExt<T> *method_definition = new MethodDefExt<T>
+ (
+ name,
+ function,
+ method_varargs_call_handler,
+ doc
+ );
+ 
+ mm[std::string( name )] = method_definition;
+ }
+ 
+ static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" )
+ {
+ method_map_t &mm = methods();
+ 
+ MethodDefExt<T> *method_definition = new MethodDefExt<T>
+ (
+ name,
+ function,
+ method_keyword_call_handler,
+ doc
+ );
+ 
+ mm[std::string( name )] = method_definition;
+ }
 
-		void initialize( const char *module_doc="" )
-			{
-			ExtensionModuleBase::initialize( module_doc );
-			Dict dict( moduleDictionary() );
-			
-			//
-			// put each of the methods into the modules dictionary
-			// so that we get called back at the function in T.
-			//
-			method_map_t &mm = methods();
-			EXPLICIT_TYPENAME method_map_t::iterator i;
-			
-			for( i=mm.begin(); i != mm.end(); ++i )
-				{
-				MethodDefExt<T> *method_definition = (*i).second;
-				
-				static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc );
-				
-				Tuple args( 2 );
-				args[0] = Object( self );
-				args[1] = String( (*i).first );
-				
-				PyObject *func = PyCFunction_New
-				(
-				&method_definition->ext_meth_def,
-				new_reference_to( args )
-				);
-				
-				dict[ (*i).first ] = Object( func );
-				}
-			}
-		
-	protected:	// Tom Malcolmson reports that derived classes need access to these
-		
-		static method_map_t &methods(void)
-			{
-			static method_map_t *map_of_methods = NULL;
-			if( map_of_methods == NULL )
-			map_of_methods = new method_map_t;
-			
-			return *map_of_methods;
-			}
-		
-		
-		// this invoke function must be called from within a try catch block
-		virtual Object invoke_method_keyword( const std::string &name, const Tuple &args, const Dict &keywords )
-			{
-			method_map_t &mm = methods();
-			MethodDefExt<T> *meth_def = mm[ name ];
-			if( meth_def == NULL )
-				{
-				std::string error_msg( "CXX - cannot invoke keyword method named " );
-				error_msg += name;
-				throw RuntimeError( error_msg );
-				}
-			
-			// cast up to the derived class
-			T *self = static_cast<T *>(this);
-			
-			return (self->*meth_def->ext_keyword_function)( args, keywords );
-			}
-		
-		// this invoke function must be called from within a try catch block
-		virtual Object invoke_method_varargs( const std::string &name, const Tuple &args )
-			{
-			method_map_t &mm = methods();
-			MethodDefExt<T> *meth_def = mm[ name ];
-			if( meth_def == NULL )
-				{
-				std::string error_msg( "CXX - cannot invoke varargs method named " );
-				error_msg += name;
-				throw RuntimeError( error_msg );
-				}
-			
-			// cast up to the derived class
-			T *self = static_cast<T *>(this);
-			
-			return (self->*meth_def->ext_varargs_function)( args );
-			}
-		
-	private:
-		//
-		// prevent the compiler generating these unwanted functions
-		//
-		ExtensionModule( const ExtensionModule<T> & );	//unimplemented
-		void operator=( const ExtensionModule<T> & );	//unimplemented
-		};
-	
-	
-	class PythonType
-		{
-	public:
-		// if you define one sequence method you must define 
-		// all of them except the assigns
-		
-		PythonType (size_t base_size, int itemsize, const char *default_name );
-		virtual ~PythonType ();
-		
-		const char *getName () const;
-		const char *getDoc () const;
+ void initialize( const char *module_doc="" )
+ {
+ ExtensionModuleBase::initialize( module_doc );
+ Dict dict( moduleDictionary() );
+ 
+ //
+ // put each of the methods into the modules dictionary
+ // so that we get called back at the function in T.
+ //
+ method_map_t &mm = methods();
+ EXPLICIT_TYPENAME method_map_t::iterator i;
+ 
+ for( i=mm.begin(); i != mm.end(); ++i )
+ {
+ MethodDefExt<T> *method_definition = (*i).second;
+ 
+ static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc );
+ 
+ Tuple args( 2 );
+ args[0] = Object( self );
+ args[1] = String( (*i).first );
+ 
+ PyObject *func = PyCFunction_New
+ (
+ &method_definition->ext_meth_def,
+ new_reference_to( args )
+ );
+ 
+ dict[ (*i).first ] = Object( func );
+ }
+ }
+ 
+ protected: // Tom Malcolmson reports that derived classes need access to these
+ 
+ static method_map_t &methods(void)
+ {
+ static method_map_t *map_of_methods = NULL;
+ if( map_of_methods == NULL )
+ map_of_methods = new method_map_t;
+ 
+ return *map_of_methods;
+ }
+ 
+ 
+ // this invoke function must be called from within a try catch block
+ virtual Object invoke_method_keyword( const std::string &name, const Tuple &args, const Dict &keywords )
+ {
+ method_map_t &mm = methods();
+ MethodDefExt<T> *meth_def = mm[ name ];
+ if( meth_def == NULL )
+ {
+ std::string error_msg( "CXX - cannot invoke keyword method named " );
+ error_msg += name;
+ throw RuntimeError( error_msg );
+ }
+ 
+ // cast up to the derived class
+ T *self = static_cast<T *>(this);
+ 
+ return (self->*meth_def->ext_keyword_function)( args, keywords );
+ }
+ 
+ // this invoke function must be called from within a try catch block
+ virtual Object invoke_method_varargs( const std::string &name, const Tuple &args )
+ {
+ method_map_t &mm = methods();
+ MethodDefExt<T> *meth_def = mm[ name ];
+ if( meth_def == NULL )
+ {
+ std::string error_msg( "CXX - cannot invoke varargs method named " );
+ error_msg += name;
+ throw RuntimeError( error_msg );
+ }
+ 
+ // cast up to the derived class
+ T *self = static_cast<T *>(this);
+ 
+ return (self->*meth_def->ext_varargs_function)( args );
+ }
+ 
+ private:
+ //
+ // prevent the compiler generating these unwanted functions
+ //
+ ExtensionModule( const ExtensionModule<T> & ); //unimplemented
+ void operator=( const ExtensionModule<T> & ); //unimplemented
+ };
+ 
+ 
+ class PythonType
+ {
+ public:
+ // if you define one sequence method you must define 
+ // all of them except the assigns
+ 
+ PythonType (size_t base_size, int itemsize, const char *default_name );
+ virtual ~PythonType ();
+ 
+ const char *getName () const;
+ const char *getDoc () const;
 
-		PyTypeObject* type_object () const;
-		void name (const char* nam);
-		void doc (const char* d);
-		void dealloc(void (*f)(PyObject*));
-		
-		void supportPrint(void);
-		void supportGetattr(void);
-		void supportSetattr(void);
-		void supportGetattro(void);
-		void supportSetattro(void);
-		void supportCompare(void);
-		void supportRepr(void);
-		void supportStr(void);
-		void supportHash(void);
-		void supportCall(void);
- void supportIter(void);
-		
-		void supportSequenceType(void);
-		void supportMappingType(void);
-		void supportNumberType(void);
-		void supportBufferType(void);
-		
-	protected:
-		PyTypeObject		*table;
-		PySequenceMethods	*sequence_table;
-		PyMappingMethods	*mapping_table;
-		PyNumberMethods		*number_table;
-		PyBufferProcs		*buffer_table;
-		
-		void init_sequence();
-		void init_mapping();
-		void init_number();
-		void init_buffer();
-		
-	private:
-		//
-		// prevent the compiler generating these unwanted functions
-		//
-		PythonType (const PythonType& tb);	// unimplemented
-		void operator=(const PythonType& t);	// unimplemented
-		
-		}; // end of PythonType
-	
-	
-	
-	// Class PythonExtension is what you inherit from to create
-	// a new Python extension type. You give your class itself
-	// as the template paramter.
-	
-	// There are two ways that extension objects can get destroyed.
-	// 1. Their reference count goes to zero
-	// 2. Someone does an explicit delete on a pointer.
-	// In (1) the problem is to get the destructor called 
-	// We register a special deallocator in the Python type object
-	// (see behaviors()) to do this.
-	// In (2) there is no problem, the dtor gets called.
-	
-	// PythonExtension does not use the usual Python heap allocator, 
-	// instead using new/delete. We do the setting of the type object
-	// and reference count, usually done by PyObject_New, in the 
-	// base class ctor.
-	
-	// This special deallocator does a delete on the pointer.
-	
-	
-	class PythonExtensionBase : public PyObject
-		{
-	public:
-		PythonExtensionBase();
-		virtual ~PythonExtensionBase();
-		
-	public:
-		virtual int print( FILE *, int );
-		virtual Object getattr( const char * ) = 0;
-		virtual int setattr( const char *, const Object & );
-		virtual Object getattro( const Object & );
-		virtual int setattro( const Object &, const Object & );
-		virtual int compare( const Object & );
-		virtual Object repr();
-		virtual Object str();
-		virtual long hash();
-		virtual Object call( const Object &, const Object & );
+ PyTypeObject* type_object () const;
+ PythonType & name (const char* nam);
+ PythonType & doc (const char* d);
+ PythonType & dealloc(void (*f)(PyObject*));
+ 
+ PythonType & supportPrint(void);
+ PythonType & supportGetattr(void);
+ PythonType & supportSetattr(void);
+ PythonType & supportGetattro(void);
+ PythonType & supportSetattro(void);
+ PythonType & supportCompare(void);
+ PythonType & supportRepr(void);
+ PythonType & supportStr(void);
+ PythonType & supportHash(void);
+ PythonType & supportCall(void);
+ PythonType & supportIter(void);
+ 
+ PythonType & supportSequenceType(void);
+ PythonType & supportMappingType(void);
+ PythonType & supportNumberType(void);
+ PythonType & supportBufferType(void);
+ 
+ protected:
+ PyTypeObject *table;
+ PySequenceMethods *sequence_table;
+ PyMappingMethods *mapping_table;
+ PyNumberMethods *number_table;
+ PyBufferProcs *buffer_table;
+ 
+ void init_sequence();
+ void init_mapping();
+ void init_number();
+ void init_buffer();
+ 
+ private:
+ //
+ // prevent the compiler generating these unwanted functions
+ //
+ PythonType (const PythonType& tb); // unimplemented
+ void operator=(const PythonType& t); // unimplemented
+ 
+ }; // end of PythonType
+ 
+ 
+ 
+ // Class PythonExtension is what you inherit from to create
+ // a new Python extension type. You give your class itself
+ // as the template paramter.
+ 
+ // There are two ways that extension objects can get destroyed.
+ // 1. Their reference count goes to zero
+ // 2. Someone does an explicit delete on a pointer.
+ // In (1) the problem is to get the destructor called 
+ // We register a special deallocator in the Python type object
+ // (see behaviors()) to do this.
+ // In (2) there is no problem, the dtor gets called.
+ 
+ // PythonExtension does not use the usual Python heap allocator, 
+ // instead using new/delete. We do the setting of the type object
+ // and reference count, usually done by PyObject_New, in the 
+ // base class ctor.
+ 
+ // This special deallocator does a delete on the pointer.
+ 
+ 
+ class PythonExtensionBase : public PyObject
+ {
+ public:
+ PythonExtensionBase();
+ virtual ~PythonExtensionBase();
+ 
+ public:
+ virtual int print( FILE *, int );
+ virtual Object getattr( const char * ) = 0;
+ virtual int setattr( const char *, const Object & );
+ virtual Object getattro( const Object & );
+ virtual int setattro( const Object &, const Object & );
+ virtual int compare( const Object & );
+ virtual Object repr();
+ virtual Object str();
+ virtual long hash();
+ virtual Object call( const Object &, const Object & );
 virtual Object iter();
 virtual PyObject* iternext();
-		
-		// Sequence methods
-		virtual int sequence_length();
-		virtual Object sequence_concat( const Object & );
-		virtual Object sequence_repeat( int );
-		virtual Object sequence_item( int );
-		virtual Object sequence_slice( int, int );
-		virtual int sequence_ass_item( int, const Object & );
-		virtual int sequence_ass_slice( int, int, const Object & );
-		
-		// Mapping
-		virtual int mapping_length();
-		virtual Object mapping_subscript( const Object & );
-		virtual int mapping_ass_subscript( const Object &, const Object & );
-		
-		// Number
-		virtual int number_nonzero();
-		virtual Object number_negative();
-		virtual Object number_positive();
-		virtual Object number_absolute();
-		virtual Object number_invert();
-		virtual Object number_int();
-		virtual Object number_float();
-		virtual Object number_long();
-		virtual Object number_oct();
-		virtual Object number_hex();
-		virtual Object number_add( const Object & );
-		virtual Object number_subtract( const Object & );
-		virtual Object number_multiply( const Object & );
-		virtual Object number_divide( const Object & );
-		virtual Object number_remainder( const Object & );
-		virtual Object number_divmod( const Object & );
-		virtual Object number_lshift( const Object & );
-		virtual Object number_rshift( const Object & );
-		virtual Object number_and( const Object & );
-		virtual Object number_xor( const Object & );
-		virtual Object number_or( const Object & );
-		virtual Object number_power( const Object &, const Object & );
-		
-		// Buffer
-		virtual Py_ssize_t buffer_getreadbuffer( Py_ssize_t, void** );
-		virtual Py_ssize_t buffer_getwritebuffer( Py_ssize_t, void** );
-		virtual Py_ssize_t buffer_getsegcount( Py_ssize_t* );
-		
-	private:
-		void missing_method( void );
-		static PyObject *method_call_handler( PyObject *self, PyObject *args );
-		};
-	
-	template<TEMPLATE_TYPENAME T>
-	class PythonExtension: public PythonExtensionBase 
-		{
-	public:
-		static PyTypeObject* type_object() 
-			{
-			return behaviors().type_object();
-			}
-		
-		static int check( PyObject *p )
-			{
-			// is p like me?
-			return p->ob_type == type_object();
-			}
-		
-		static int check( const Object& ob )
-			{
-			return check( ob.ptr());
-			}
-		
-		
-		//
-		// every object needs getattr implemented
-		// to support methods
-		//
-		virtual Object getattr( const char *name )
-			{
-			return getattr_methods( name );
-			}
-		
-	protected:
-		explicit PythonExtension()
-			: PythonExtensionBase()
-			{
-			#ifdef PyObject_INIT
-			 (void)PyObject_INIT( this, type_object() );
-			#else
-			 ob_refcnt = 1;
-			 ob_type = type_object();
-			#endif
-			
-			// every object must support getattr
-			behaviors().supportGetattr();
-			}
-		
-		virtual ~PythonExtension()
-			{} 
-		
-		static PythonType &behaviors()
-			{
-			static PythonType* p;
-			if( p == NULL ) 
-				{
+ 
+ // Sequence methods
+ virtual int sequence_length();
+ virtual Object sequence_concat( const Object & );
+ virtual Object sequence_repeat( Py_ssize_t );
+ virtual Object sequence_item( Py_ssize_t );
+ virtual Object sequence_slice( Py_ssize_t, Py_ssize_t );
+ virtual int sequence_ass_item( Py_ssize_t, const Object & );
+ virtual int sequence_ass_slice( Py_ssize_t, Py_ssize_t, const Object & );
+ 
+ // Mapping
+ virtual int mapping_length();
+ virtual Object mapping_subscript( const Object & );
+ virtual int mapping_ass_subscript( const Object &, const Object & );
+ 
+ // Number
+ virtual int number_nonzero();
+ virtual Object number_negative();
+ virtual Object number_positive();
+ virtual Object number_absolute();
+ virtual Object number_invert();
+ virtual Object number_int();
+ virtual Object number_float();
+ virtual Object number_long();
+ virtual Object number_oct();
+ virtual Object number_hex();
+ virtual Object number_add( const Object & );
+ virtual Object number_subtract( const Object & );
+ virtual Object number_multiply( const Object & );
+ virtual Object number_divide( const Object & );
+ virtual Object number_remainder( const Object & );
+ virtual Object number_divmod( const Object & );
+ virtual Object number_lshift( const Object & );
+ virtual Object number_rshift( const Object & );
+ virtual Object number_and( const Object & );
+ virtual Object number_xor( const Object & );
+ virtual Object number_or( const Object & );
+ virtual Object number_power( const Object &, const Object & );
+ 
+ // Buffer
+ virtual Py_ssize_t buffer_getreadbuffer( Py_ssize_t, void** );
+ virtual Py_ssize_t buffer_getwritebuffer( Py_ssize_t, void** );
+ virtual Py_ssize_t buffer_getsegcount( Py_ssize_t* );
+ 
+ private:
+ void missing_method( void );
+ static PyObject *method_call_handler( PyObject *self, PyObject *args );
+ };
+ 
+ template<TEMPLATE_TYPENAME T>
+ class PythonExtension: public PythonExtensionBase 
+ {
+ public:
+ static PyTypeObject* type_object() 
+ {
+ return behaviors().type_object();
+ }
+ 
+ static int check( PyObject *p )
+ {
+ // is p like me?
+ return p->ob_type == type_object();
+ }
+ 
+ static int check( const Object& ob )
+ {
+ return check( ob.ptr());
+ }
+ 
+ 
+ //
+ // every object needs getattr implemented
+ // to support methods
+ //
+ virtual Object getattr( const char *name )
+ {
+ return getattr_methods( name );
+ }
+ 
+ protected:
+ explicit PythonExtension()
+ : PythonExtensionBase()
+ {
+ #ifdef PyObject_INIT
+ (void)PyObject_INIT( this, type_object() );
+ #else
+ ob_refcnt = 1;
+ ob_type = type_object();
+ #endif
+ 
+ // every object must support getattr
+ behaviors().supportGetattr();
+ }
+ 
+ virtual ~PythonExtension()
+ {} 
+ 
+ static PythonType &behaviors()
+ {
+ static PythonType* p;
+ if( p == NULL ) 
+ {
 #if defined( _CPPRTTI ) || defined(__GNUG__)
-				const char *default_name = (typeid ( T )).name();
+ const char *default_name = (typeid ( T )).name();
 #else
-				const char *default_name = "unknown";
+ const char *default_name = "unknown";
 #endif
-				p = new PythonType( sizeof( T ), 0, default_name );
-				p->dealloc( extension_object_deallocator );
-				}
-			
-			return *p;
-			}
-		
-		
-		typedef Object (T::*method_varargs_function_t)( const Tuple &args );
-		typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
-		typedef std::map<std::string,MethodDefExt<T> *> method_map_t;
-		
-		// support the default attributes, __name__, __doc__ and methods
-		virtual Object getattr_default( const char *_name )
-			{
-			std::string name( _name );
+ p = new PythonType( sizeof( T ), 0, default_name );
+ p->dealloc( extension_object_deallocator );
+ }
+ 
+ return *p;
+ }
+ 
+ 
+ typedef Object (T::*method_varargs_function_t)( const Tuple &args );
+ typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
+ typedef std::map<std::string,MethodDefExt<T> *> method_map_t;
+ 
+ // support the default attributes, __name__, __doc__ and methods
+ virtual Object getattr_default( const char *_name )
+ {
+ std::string name( _name );
 
-			if( name == "__name__" && type_object()->tp_name != NULL )
-				{
-				return Py::String( type_object()->tp_name );
-				}
-			else if( name == "__doc__" && type_object()->tp_doc != NULL )
-				{
-				return Py::String( type_object()->tp_doc );
-				}
+ if( name == "__name__" && type_object()->tp_name != NULL )
+ {
+ return Py::String( type_object()->tp_name );
+ }
+ if( name == "__doc__" && type_object()->tp_doc != NULL )
+ {
+ return Py::String( type_object()->tp_doc );
+ }
 
 // trying to fake out being a class for help()
-//			else if( name == "__bases__" )
-//				{
-//				return Py::Tuple(0);
-//				}
-//			else if( name == "__module__" )
-//				{
-//				return Py::Nothing();
-//				}
-//			else if( name == "__dict__" )
-//				{
-//				return Py::Dict();
-//				}
-			else
-				{
-				return getattr_methods( _name );
-				}
-			}
+// else if( name == "__bases__" )
+// {
+// return Py::Tuple(0);
+// }
+// else if( name == "__module__" )
+// {
+// return Py::Nothing();
+// }
+// else if( name == "__dict__" )
+// {
+// return Py::Dict();
+// }
 
-		// turn a name into function object
-		virtual Object getattr_methods( const char *_name )
-			{
-			std::string name( _name );
-			
-			method_map_t &mm = methods();
-			
-			if( name == "__methods__" )
-				{
-				List methods;
-				
-				for( EXPLICIT_TYPENAME method_map_t::iterator i = mm.begin(); i != mm.end(); ++i )
-					methods.append( String( (*i).first ) );
-				
-				return methods;
-				}
-			
-			// see if name exists
-			if( mm.find( name ) == mm.end() )
-				throw AttributeError( name );
-			
-			Tuple self( 2 );
-			
-			self[0] = Object( this );
-			self[1] = String( name );
-			
-			MethodDefExt<T> *method_definition = mm[ name ];
-			
-			PyObject *func = PyCFunction_New( &method_definition->ext_meth_def, self.ptr() );
-			
-			return Object(func, true);
-			}
-		
-		static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" )
-			{
-			method_map_t &mm = methods();
-			
-			MethodDefExt<T> *method_definition = new MethodDefExt<T>
-			(
-			name,
-			function,
-			method_varargs_call_handler,
-			doc
-			);
-			
-			mm[std::string( name )] = method_definition;
-			}
-		
-		static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" )
-			{
-			method_map_t &mm = methods();
-			
-			MethodDefExt<T> *method_definition = new MethodDefExt<T>
-			(
-			name,
-			function,
-			method_keyword_call_handler,
-			doc
-			);
-			
-			mm[std::string( name )] = method_definition;
-			}
-		
-	private:
-		static method_map_t &methods(void)
-			{
-			static method_map_t *map_of_methods = NULL;
-			if( map_of_methods == NULL )
-			map_of_methods = new method_map_t;
-			
-			return *map_of_methods;
-			}
-		
-		static PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords )
-			{
-			try
-				{
-				Tuple self_and_name_tuple( _self_and_name_tuple );
-				
-				PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
-				T *self = static_cast<T *>( self_in_cobject );
-				
-				String name( self_and_name_tuple[1] );
-				
-				method_map_t &mm = methods();
-				MethodDefExt<T> *meth_def = mm[ name ];
-				if( meth_def == NULL )
-					return 0;
-				
-				Tuple args( _args );
+ return getattr_methods( _name );
+ }
 
-				// _keywords may be NULL so be careful about the way the dict is created
-				Dict keywords;
-				if( _keywords != NULL )
-					keywords = Dict( _keywords );
-				
-				Object result( (self->*meth_def->ext_keyword_function)( args, keywords ) );
-				
-				return new_reference_to( result.ptr() );
-				}
-			catch( Exception & )
-				{
-				return 0;
-				}
-			}
-		
-		static PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args )
-			{
-			try
-				{
-				Tuple self_and_name_tuple( _self_and_name_tuple );
-				
-				PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
-				T *self = static_cast<T *>( self_in_cobject );
-				
-				String name( self_and_name_tuple[1] );
-				
-				method_map_t &mm = methods();
-				MethodDefExt<T> *meth_def = mm[ name ];
-				if( meth_def == NULL )
-					return 0;
-				
-				Tuple args( _args );
-				
-				Object result;
-				
-				// TMM: 7Jun'01 - Adding try & catch in case of STL debug-mode exceptions.
-				#ifdef _STLP_DEBUG
-				try
-					{
-					result = (self->*meth_def->ext_varargs_function)( args );
-					}
-				catch (std::__stl_debug_exception)
-					{
-					// throw cxx::RuntimeError( sErrMsg );
-					throw cxx::RuntimeError( "Error message not set yet." );
-					}
-				#else
-				result = (self->*meth_def->ext_varargs_function)( args );
-				#endif // _STLP_DEBUG
-				
-				return new_reference_to( result.ptr() );
-				}
-			catch( Exception & )
-				{
-				return 0;
-				}
-			}
-		
-		static void extension_object_deallocator ( PyObject* t )
-			{
-			delete (T *)( t );
-			}
-		
-		//
-		// prevent the compiler generating these unwanted functions
-		//
-		explicit PythonExtension( const PythonExtension<T>& other );
-		void operator=( const PythonExtension<T>& rhs );
-		};
-	
-	//
-	// ExtensionObject<T> is an Object that will accept only T's.
-	//
-	template<TEMPLATE_TYPENAME T>
-	class ExtensionObject: public Object
-		{
-	public:
-		
-		explicit ExtensionObject ( PyObject *pyob )
-			: Object( pyob )
-			{
-			validate();
-			}
-		
-		ExtensionObject( const ExtensionObject<T>& other )
-			: Object( *other )
-			{
-			validate();
-			}
-		
-		ExtensionObject( const Object& other )
-			: Object( *other )
-			{
-			validate();
-			}
-		
-		ExtensionObject& operator= ( const Object& rhs )
-			{
-			return (*this = *rhs );
-			}
-		
-		ExtensionObject& operator= ( PyObject* rhsp )
-			{
-			if( ptr() == rhsp )
-			return *this;
-			set( rhsp );
-			return *this;
-			}
-		
-		virtual bool accepts ( PyObject *pyob ) const
-			{
-			return ( pyob && T::check( pyob ));
-			} 
-		
-		//
-		//	Obtain a pointer to the PythonExtension object
-		//
-		T *extensionObject(void)
-			{
-			return static_cast<T *>( ptr() );
-			}
-		};
-	
-	} // Namespace Py
+ // turn a name into function object
+ virtual Object getattr_methods( const char *_name )
+ {
+ std::string name( _name );
+ 
+ method_map_t &mm = methods();
+ 
+ if( name == "__methods__" )
+ {
+ List methods;
+ 
+ for( EXPLICIT_TYPENAME method_map_t::iterator i = mm.begin(); i != mm.end(); ++i )
+ methods.append( String( (*i).first ) );
+ 
+ return methods;
+ }
+ 
+ // see if name exists
+ if( mm.find( name ) == mm.end() )
+ throw AttributeError( name );
+ 
+ Tuple self( 2 );
+ 
+ self[0] = Object( this );
+ self[1] = String( name );
+ 
+ MethodDefExt<T> *method_definition = mm[ name ];
+ 
+ PyObject *func = PyCFunction_New( &method_definition->ext_meth_def, self.ptr() );
+ 
+ return Object(func, true);
+ }
+ 
+ static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" )
+ {
+ method_map_t &mm = methods();
+ 
+ MethodDefExt<T> *method_definition = new MethodDefExt<T>
+ (
+ name,
+ function,
+ method_varargs_call_handler,
+ doc
+ );
+ 
+ mm[std::string( name )] = method_definition;
+ }
+ 
+ static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" )
+ {
+ method_map_t &mm = methods();
+ 
+ MethodDefExt<T> *method_definition = new MethodDefExt<T>
+ (
+ name,
+ function,
+ method_keyword_call_handler,
+ doc
+ );
+ 
+ mm[std::string( name )] = method_definition;
+ }
+ 
+ private:
+ static method_map_t &methods(void)
+ {
+ static method_map_t *map_of_methods = NULL;
+ if( map_of_methods == NULL )
+ map_of_methods = new method_map_t;
+ 
+ return *map_of_methods;
+ }
+ 
+ static PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords )
+ {
+ try
+ {
+ Tuple self_and_name_tuple( _self_and_name_tuple );
+ 
+ PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
+ T *self = static_cast<T *>( self_in_cobject );
+ 
+ String name( self_and_name_tuple[1] );
+ 
+ method_map_t &mm = methods();
+ MethodDefExt<T> *meth_def = mm[ name ];
+ if( meth_def == NULL )
+ return 0;
+ 
+ Tuple args( _args );
+
+ // _keywords may be NULL so be careful about the way the dict is created
+ Dict keywords;
+ if( _keywords != NULL )
+ keywords = Dict( _keywords );
+ 
+ Object result( (self->*meth_def->ext_keyword_function)( args, keywords ) );
+ 
+ return new_reference_to( result.ptr() );
+ }
+ catch( Exception & )
+ {
+ return 0;
+ }
+ }
+ 
+ static PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args )
+ {
+ try
+ {
+ Tuple self_and_name_tuple( _self_and_name_tuple );
+ 
+ PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
+ T *self = static_cast<T *>( self_in_cobject );
+ 
+ String name( self_and_name_tuple[1] );
+ 
+ method_map_t &mm = methods();
+ MethodDefExt<T> *meth_def = mm[ name ];
+ if( meth_def == NULL )
+ return 0;
+ 
+ Tuple args( _args );
+ 
+ Object result;
+ 
+ ...
 
[truncated message content]
From: <md...@us...> - 2007年08月23日 17:59:23
Revision: 3733
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3733&view=rev
Author: mdboom
Date: 2007年08月23日 10:59:21 -0700 (2007年8月23日)
Log Message:
-----------
Extremely minor bugfix that prevents the cycle finder from printing
out dictionaries.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月23日 17:58:49 UTC (rev 3732)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月23日 17:59:21 UTC (rev 3733)
@@ -936,7 +936,7 @@
 recurse(referent, start, all, current_path + [obj])
 
 for obj in objects:
- outstream.write("Examining: %r\n" % obj)
+ outstream.write("Examining: %r\n" % (obj,))
 recurse(obj, obj, { }, [])
 
 if __name__=='__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月23日 17:58:51
Revision: 3732
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3732&view=rev
Author: mdboom
Date: 2007年08月23日 10:58:49 -0700 (2007年8月23日)
Log Message:
-----------
Fix \sqrt (broken when I made the parser more strict).
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月23日 06:58:10 UTC (rev 3731)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月23日 17:58:49 UTC (rev 3732)
@@ -30,6 +30,7 @@
 r'\bigwedge' : ('cmex10', 4),
 r'\bigvee' : ('cmex10', 37),
 r'\coprod' : ('cmex10', 42),
+ r'\__sqrt__' : ('cmex10', 48),
 r'\leftbrace' : ('cmex10', 92),
 r'{' : ('cmex10', 92),
 r'\{' : ('cmex10', 92),
@@ -316,6 +317,7 @@
 r'\Pi' : ('psyr', 213),
 r'\prod' : ('psyr', 213),
 r'\surd' : ('psyr', 214),
+ r'\__sqrt__' : ('psyr', 214),
 r'\cdot' : ('psyr', 215),
 r'\urcorner' : ('psyr', 216),
 r'\vee' : ('psyr', 217),
@@ -2044,6 +2046,7 @@
 'rightzigzagarrow': 8669,
 'rightarrow': 8594,
 'leftarrow': 8592,
+'__sqrt__': 8730, 
 'twoheaddownarrow': 8609,
 'oint': 8750,
 'bigvee': 8897,
@@ -2553,6 +2556,7 @@
 'rightzigzagarrow': 'uni21DD',
 'rightarrow': 'uni2192',
 'leftarrow': 'uni2190',
+'__sqrt__': 'uni221A', 
 'twoheaddownarrow': 'uni21A1',
 'oint': 'uni222E',
 'bigvee': 'uni22C1',
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月23日 06:58:10 UTC (rev 3731)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月23日 17:58:49 UTC (rev 3732)
@@ -645,7 +645,7 @@
 ('ex', '\xbf'), ('ex', '\x2a')],
 r'\rangle' : [('cal', '\x69'), ('ex', '\xae'), ('ex', '\x45'),
 ('ex', '\xc0'), ('ex', '\x2b')],
- r'\sqrt' : [('cal', '\x70'), ('ex', '\x70'), ('ex', '\x71'),
+ r'\__sqrt__' : [('cal', '\x70'), ('ex', '\x70'), ('ex', '\x71'),
 ('ex', '\x72'), ('ex', '\x73')],
 r'\backslash': [('cal', '\x6e'), ('ex', '\xb2'), ('ex', '\x2f'),
 ('ex', '\xc2'), ('ex', '\x2d')],
@@ -2296,7 +2296,7 @@
 # the height so it doesn't seem cramped
 height = body.height - body.shift_amount + thickness * 5.0
 depth = body.depth + body.shift_amount
- check = AutoHeightChar(r'\sqrt', height, depth, state, always=True)
+ check = AutoHeightChar(r'\__sqrt__', height, depth, state, always=True)
 height = check.height - check.shift_amount
 depth = check.depth + check.shift_amount
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2007年08月23日 06:58:13
Revision: 3731
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3731&view=rev
Author: jouni
Date: 2007年08月22日 23:58:10 -0700 (2007年8月22日)
Log Message:
-----------
Fix a buglet affecting getp: if a numpy object has shape==(), 
you cannot take its length.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/artist.py
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py	2007年08月22日 20:11:18 UTC (rev 3730)
+++ trunk/matplotlib/lib/matplotlib/artist.py	2007年08月23日 06:58:10 UTC (rev 3731)
@@ -588,7 +588,7 @@
 if self.is_alias(func): continue
 try: val = func()
 except: continue
- if hasattr(val, 'shape') and len(val)>6:
+ if getattr(val, 'shape', ()) != () and len(val)>6:
 s = str(val[:6]) + '...'
 else:
 s = str(val)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3730
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3730&view=rev
Author: dsdale
Date: 2007年08月22日 13:11:18 -0700 (2007年8月22日)
Log Message:
-----------
rcdefaults working with mplconfig
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月22日 19:38:08 UTC (rev 3729)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月22日 20:11:18 UTC (rev 3730)
@@ -516,10 +516,14 @@
 config_file)
 
 def rcdefaults():
- global mplConfig
- mplConfig = MPLConfig()
- rcParams.update(rcParamsDefault)
+ """
+ Restore the default rc params - the ones that were created at
+ matplotlib load time
+ """
+ for key in rcParamsDefault.keys():
+ rcParams[key] = rcParamsDefault[key]
 
+
 ##############################################################################
 # Auto-generate the mpl-data/matplotlib.conf
 ##############################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月22日 19:38:18
Revision: 3729
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3729&view=rev
Author: mdboom
Date: 2007年08月22日 12:38:08 -0700 (2007年8月22日)
Log Message:
-----------
Make rcParams.update(rcParamsDefault) when new traited config is
switched on.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/config/mpltraits.py
 trunk/matplotlib/lib/matplotlib/rcsetup.py
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月22日 18:43:13 UTC (rev 3728)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月22日 19:38:08 UTC (rev 3729)
@@ -161,12 +161,14 @@
 dvipnghack = T.false
 
 class mathtext(TConfig):
- cal = T.Trait("['cursive']", mplT.FontPropertiesHandler())
- rm = T.Trait("['serif']", mplT.FontPropertiesHandler())
- tt = T.Trait("['monospace']", mplT.FontPropertiesHandler())
- it = T.Trait("['serif'], style='oblique'", mplT.FontPropertiesHandler())
- bf = T.Trait("['serif'], weight='bold'", mplT.FontPropertiesHandler())
- sf = T.Trait("['sans-serif']", mplT.FontPropertiesHandler())
+ handler = mplT.FontPropertiesHandler
+ proxy = handler.FontPropertiesProxy
+ cal = T.Trait(proxy(['cursive']), handler())
+ rm = T.Trait(proxy(['serif']), handler())
+ tt = T.Trait(proxy(['monospace']), handler())
+ it = T.Trait(proxy(['serif'], style='oblique'), handler())
+ bf = T.Trait(proxy(['serif'], weight='bold'), handler())
+ sf = T.Trait(proxy(['sans-serif']), handler())
 use_cm = T.true
 fallback_to_cm = T.true
 
Modified: trunk/matplotlib/lib/matplotlib/config/mpltraits.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月22日 18:43:13 UTC (rev 3728)
+++ trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月22日 19:38:08 UTC (rev 3729)
@@ -146,7 +146,7 @@
 'spring_r', 'summer', 'summer_r', 'winter', 'winter_r']
 
 class FontPropertiesHandler(T.TraitHandler):
- class FontPropertiesProxy:
+ class FontPropertiesProxy(object):
 # In order to build a FontProperties object, various rcParams must
 # already be known in order to set default values. That means a
 # FontProperties object can not be created from a config file,
@@ -192,8 +192,6 @@
 
 def validate(self, object, name, value):
 from matplotlib.font_manager import FontProperties
- if isinstance(value, FontProperties):
- return value
 if is_string_like(value):
 try:
 proxy = eval("FontProperties(%s)" % value,
@@ -202,7 +200,9 @@
 pass
 else:
 return proxy
+ else:
+ return value
 self.error(object, name, value)
 
 def info(self):
- return 'Represents a set of font properties. Must be a FontProperties object or a string containing the parameters to the FontProperties constructor.'
+ return 'a FontProperties object or a string containing the parameters to the FontProperties constructor.'
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月22日 18:43:13 UTC (rev 3728)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月22日 19:38:08 UTC (rev 3729)
@@ -198,7 +198,7 @@
 except ValueError:
 raise ValueError('not a valid font size')
 
-class FontPropertiesProxy:
+class FontPropertiesProxy(object):
 # In order to build a FontProperties object, various rcParams must
 # already be known in order to set default values. That means a
 # FontProperties object can not be created from a config file,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3728
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3728&view=rev
Author: dsdale
Date: 2007年08月22日 11:43:13 -0700 (2007年8月22日)
Log Message:
-----------
add an update method to rcParamsWrapper
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月21日 19:42:28 UTC (rev 3727)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月22日 18:43:13 UTC (rev 3728)
@@ -461,7 +461,18 @@
 def has_key(self, val):
 return self.tconfig_map.has_key(val)
 
+ def update(self, arg, **kwargs):
+ try:
+ for key in arg:
+ self[key] = arg[key]
+ except AttributeError:
+ for key, val in arg:
+ self[key] = val
+ 
+ for key in kwargs:
+ self[key] = kwargs[key]
 
+
 old_config_file = cutils.get_config_file(tconfig=False)
 old_config_path = os.path.split(old_config_file)[0]
 config_file = os.path.join(old_config_path, 'matplotlib.conf')
@@ -503,8 +514,9 @@
 config_file)
 
 def rcdefaults():
+ global mplConfig
 mplConfig = MPLConfig()
- rcParams = RcParamsWrapper(mplConfig)
+ rcParams.update(rcParamsDefault)
 
 ##############################################################################
 # Auto-generate the mpl-data/matplotlib.conf
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2007年08月21日 19:42:37
Revision: 3727
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3727&view=rev
Author: jouni
Date: 2007年08月21日 12:42:28 -0700 (2007年8月21日)
Log Message:
-----------
Run a simple sanity check to avoid attempting to parse non-AFM files as AFM.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/afm.py
Modified: trunk/matplotlib/lib/matplotlib/afm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/afm.py	2007年08月21日 19:10:02 UTC (rev 3726)
+++ trunk/matplotlib/lib/matplotlib/afm.py	2007年08月21日 19:42:28 UTC (rev 3727)
@@ -53,7 +53,27 @@
 else: return True
 
 
+def _sanity_check(fh):
+ """
+ Check if the file at least looks like AFM. 
+ If not, raise RuntimeError.
+ """
 
+ # Remember the file position in case the caller wants to
+ # do something else with the file.
+ pos = fh.tell()
+ try:
+ line = fh.readline()
+ finally:
+ fh.seek(pos, 0)
+
+ # AFM spec, Section 4: The StartFontMetrics keyword [followed by a
+ # version number] must be the first line in the file, and the
+ # EndFontMetrics keyword must be the last non-empty line in the
+ # file. We just check the first line.
+ if not line.startswith('StartFontMetrics'):
+ raise RuntimeError('Not an AFM file')
+
 def _parse_header(fh):
 """
 Reads the font metrics header (up to the char metrics) and returns
@@ -255,6 +275,7 @@
 dkernpairs : a parse_kern_pairs dict, possibly {}
 dcomposite : a parse_composites dict , possibly {}
 """
+ _sanity_check(fh)
 dhead = _parse_header(fh)
 dcmetrics = _parse_char_metrics(fh)
 doptional = _parse_optional(fh)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月21日 19:10:09
Revision: 3726
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3726&view=rev
Author: mdboom
Date: 2007年08月21日 12:10:02 -0700 (2007年8月21日)
Log Message:
-----------
Fix message about wxAgg version requirement.
Modified Paths:
--------------
 trunk/matplotlib/setup.py
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py	2007年08月21日 19:08:55 UTC (rev 3725)
+++ trunk/matplotlib/setup.py	2007年08月21日 19:10:02 UTC (rev 3726)
@@ -241,7 +241,7 @@
 build_wxagg(ext_modules, packages)
 wxagg_backend_status = "yes"
 else:
- print_message("WxAgg extension not required for wxPython < 2.8")
+ print_message("WxAgg extension not required for wxPython >= 2.8")
 rc['backend'] = 'WXAgg'
 
 # These are informational only. We don't build
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月21日 19:08:59
Revision: 3725
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3725&view=rev
Author: mdboom
Date: 2007年08月21日 12:08:55 -0700 (2007年8月21日)
Log Message:
-----------
Fix the parser so it doesn't silently fail. Speed up by using
pyparsing's packrat feature.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月21日 17:25:57 UTC (rev 3724)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月21日 19:08:55 UTC (rev 3725)
@@ -30,7 +30,6 @@
 r'\bigwedge' : ('cmex10', 4),
 r'\bigvee' : ('cmex10', 37),
 r'\coprod' : ('cmex10', 42),
- r'\sqrt' : ('cmex10', 48),
 r'\leftbrace' : ('cmex10', 92),
 r'{' : ('cmex10', 92),
 r'\{' : ('cmex10', 92),
@@ -317,7 +316,6 @@
 r'\Pi' : ('psyr', 213),
 r'\prod' : ('psyr', 213),
 r'\surd' : ('psyr', 214),
- r'\sqrt' : ('psyr', 214),
 r'\cdot' : ('psyr', 215),
 r'\urcorner' : ('psyr', 216),
 r'\vee' : ('psyr', 217),
@@ -2046,7 +2044,6 @@
 'rightzigzagarrow': 8669,
 'rightarrow': 8594,
 'leftarrow': 8592,
-'sqrt': 8730,
 'twoheaddownarrow': 8609,
 'oint': 8750,
 'bigvee': 8897,
@@ -2556,7 +2553,6 @@
 'rightzigzagarrow': 'uni21DD',
 'rightarrow': 'uni2192',
 'leftarrow': 'uni2190',
-'sqrt': 'uni221A',
 'twoheaddownarrow': 'uni21A1',
 'oint': 'uni222E',
 'bigvee': 'uni22C1',
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 17:25:57 UTC (rev 3724)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 19:08:55 UTC (rev 3725)
@@ -143,7 +143,7 @@
 Combine, Group, Optional, Forward, NotAny, alphas, nums, alphanums, \
 StringStart, StringEnd, ParseFatalException, FollowedBy, Regex, \
 operatorPrecedence, opAssoc, ParseResults, Or, Suppress, oneOf, \
- ParseException, MatchFirst
+ ParseException, MatchFirst, NoMatch
 
 from matplotlib.afm import AFM
 from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat, \
@@ -1806,12 +1806,12 @@
 + rbrace
 ).setParseAction(self.customspace).setName('customspace')
 
- symbol =(Regex(r"[a-zA-Z0-9 +\-*/<>=:,.;!'@()[\]]")
- ^ Combine(
- bslash
- + oneOf(tex2uni.keys())
- )
- ).setParseAction(self.symbol).leaveWhitespace()
+ symbol =(Regex(r"([a-zA-Z0-9 +\-*/<>=:,.;!'@()])|(\\[%${}\[\]])")
+ | Combine(
+ bslash
+ + oneOf(tex2uni.keys())
+ )
+ ).setParseAction(self.symbol).leaveWhitespace()
 
 accent = Group(
 Combine(bslash + accent)
@@ -1823,7 +1823,7 @@
 
 group = Group(
 start_group
- + OneOrMore(
+ + ZeroOrMore(
 autoDelim
 | simple)
 + end_group
@@ -1907,7 +1907,7 @@
 
 math = OneOrMore(
 autoDelim
- | simple
+ ^ simple
 ).setParseAction(self.math).setName("math")
 
 math_delim =(~bslash
@@ -1916,16 +1916,18 @@
 non_math = Regex(r"(?:[^$]|(?:\\\$))*"
 ).setParseAction(self.non_math).setName("non_math").leaveWhitespace()
 
- self._expression <<(
- non_math
- + ZeroOrMore(
- Suppress(math_delim)
- + math
- + Suppress(math_delim)
- + non_math
- )
- )
+ self._expression << (
+ non_math
+ + ZeroOrMore(
+ Suppress(math_delim)
+ + math
+ + Suppress(math_delim)
+ + non_math
+ ) 
+ ) + StringEnd()
 
+ self._expression.enablePackrat()
+ 
 self.clear()
 
 def clear(self):
@@ -1966,6 +1968,7 @@
 self._state_stack.append(self.get_state().copy())
 
 def finish(self, s, loc, toks):
+ #~ print "finish", toks
 self._expr = Hlist(toks)
 return [self._expr]
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月21日 17:26:00
Revision: 3724
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3724&view=rev
Author: mdboom
Date: 2007年08月21日 10:25:57 -0700 (2007年8月21日)
Log Message:
-----------
Making parser more robust -- will only accept valid symbol names.
(Re-)adding \hspace{ } command.
Modified Paths:
--------------
 trunk/matplotlib/examples/mathtext_examples.py
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/examples/mathtext_examples.py
===================================================================
--- trunk/matplotlib/examples/mathtext_examples.py	2007年08月21日 15:24:26 UTC (rev 3723)
+++ trunk/matplotlib/examples/mathtext_examples.py	2007年08月21日 17:25:57 UTC (rev 3724)
@@ -9,7 +9,7 @@
 r'100ドル\%y\ x*y\ x/y x\$y$',
 r'$x\leftarrow y\ x\forall y\ x-y$',
 r'$x \sf x \bf x {\cal X} \rm x$',
- r'$x\ x,円x\;x\quad x\qquad x\!x$',
+ r'$x\ x,円x\;x\quad x\qquad x\!x\hspace{0.5}y$',
 r'$\{ \rm braces \}$',
 r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} y\right)\right]$',
 r'$\left(x\right)$',
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月21日 15:24:26 UTC (rev 3723)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年08月21日 17:25:57 UTC (rev 3724)
@@ -1763,7 +1763,6 @@
 'Theta': 920,
 'origof': 8886,
 'blacksquare': 9632,
-'hspace': 8202,
 'solbar': 9023,
 'neg': 172,
 'sum': 8721,
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 15:24:26 UTC (rev 3723)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 17:25:57 UTC (rev 3724)
@@ -1750,12 +1750,10 @@
 _overunder_symbols = Set(r'''
 \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee
 \bigwedge \bigodot \bigotimes \bigoplus \biguplus
- '''.split()
- )
+ '''.split())
 
 _overunder_functions = Set(
- r"lim liminf limsup sup max min".split()
- )
+ r"lim liminf limsup sup max min".split())
 
 _dropsub_symbols = Set(r'''\int \oint'''.split())
 
@@ -1769,11 +1767,13 @@
 autoDelim = Forward().setParseAction(self.auto_sized_delimiter)
 self._expression = Forward().setParseAction(self.finish).setName("finish")
 
+ float = Regex(r"-?[0-9]+\.?[0-9]*")
+ 
 lbrace = Literal('{').suppress()
 rbrace = Literal('}').suppress()
 start_group = (Optional(latexfont) + lbrace)
 start_group.setParseAction(self.start_group)
- end_group = rbrace
+ end_group = rbrace.copy()
 end_group.setParseAction(self.end_group)
 
 bslash = Literal('\\')
@@ -1786,15 +1786,9 @@
 "cosh gcd ln sup cot hom log tan coth inf max "
 "tanh")
 
- number = Combine(Word(nums) + Optional(Literal('.')) + Optional( Word(nums) ))
-
 fontname = oneOf("rm cal it tt sf bf")
 latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf")
 
- texsym = Combine(bslash + Word(alphanums) + NotAny("{"))
-
- char = Word(alphanums + ' ', exact=1).leaveWhitespace()
-
 space =(FollowedBy(bslash)
 + (Literal(r'\ ')
 | Literal(r'\/')
@@ -1806,19 +1800,18 @@
 )
 ).setParseAction(self.space).setName('space')
 
- symbol = Regex("(" + ")|(".join(
- [
- r"\\(?!quad)(?!qquad)(?!left[^a-z])(?!right[^a-z])[a-zA-Z0-9]+(?!{)",
- r"[a-zA-Z0-9 ]",
- r"[+\-*/]",
- r"[<>=]",
- r"[:,.;!'@[()]",
- r"\\[$%{}]",
- ])
- + ")"
- ).setParseAction(self.symbol).leaveWhitespace()
+ customspace =(Literal(r'\hspace')
+ + lbrace
+ + float
+ + rbrace
+ ).setParseAction(self.customspace).setName('customspace')
 
- rightBracket = Literal("[").setParseAction(self.symbol).leaveWhitespace()
+ symbol =(Regex(r"[a-zA-Z0-9 +\-*/<>=:,.;!'@()[\]]")
+ ^ Combine(
+ bslash
+ + oneOf(tex2uni.keys())
+ )
+ ).setParseAction(self.symbol).leaveWhitespace()
 
 accent = Group(
 Combine(bslash + accent)
@@ -1873,13 +1866,13 @@
 placeable <<(accent
 ^ function
 ^ symbol
- ^ rightBracket
 ^ group
 ^ frac
 ^ sqrt
 )
 
 simple <<(space
+ | customspace 
 | font
 | subsuper
 )
@@ -2016,6 +2009,9 @@
 box = self._make_space(num)
 return [box]
 
+ def customspace(self, s, loc, toks):
+ return [self._make_space(float(toks[1]))]
+ 
 def symbol(self, s, loc, toks):
 # print "symbol", toks
 c = toks[0]
@@ -2226,7 +2222,8 @@
 y = Hlist([sub])
 # y.width += SCRIPT_SPACE * xHeight
 shift_down = max(shift_down, SUB1 * xHeight)
- clr = 2.0 * rule_thickness - ((shift_up - x.depth) - (y.height - shift_down))
+ clr = (2.0 * rule_thickness -
+ ((shift_up - x.depth) - (y.height - shift_down)))
 if clr > 0.:
 shift_up += clr
 shift_down += clr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月21日 15:25:30
Revision: 3723
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3723&view=rev
Author: mdboom
Date: 2007年08月21日 08:24:26 -0700 (2007年8月21日)
Log Message:
-----------
Fix docstring
Modified Paths:
--------------
 trunk/matplotlib/src/_ttconv.cpp
Modified: trunk/matplotlib/src/_ttconv.cpp
===================================================================
--- trunk/matplotlib/src/_ttconv.cpp	2007年08月21日 15:19:04 UTC (rev 3722)
+++ trunk/matplotlib/src/_ttconv.cpp	2007年08月21日 15:24:26 UTC (rev 3723)
@@ -195,12 +195,12 @@
 "get_pdf_charprocs(filename, glyph_ids)\n"
 "\n"
 "Given a Truetype font file, returns a dictionary containing the PDF Type 3\n"
- "representation of its path. Useful for subsetting a Truetype font inside\n"
+ "representation of its paths. Useful for subsetting a Truetype font inside\n"
 "of a PDF file.\n"
 "\n"
 "filename is the path to a TTF font file.\n"
 "glyph_ids is a list of the numeric glyph ids to include.\n"
- "The return value is a dictionary where the keys are glyph names and \n"
+ "The return value is a dictionary where the keys are glyph names and\n"
 "the values are the stream content needed to render that glyph. This\n"
 "is useful to generate the CharProcs dictionary in a PDF Type 3 font.\n"
 },
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月21日 15:19:33
Revision: 3722
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3722&view=rev
Author: mdboom
Date: 2007年08月21日 08:19:04 -0700 (2007年8月21日)
Log Message:
-----------
Prevent the mathtext cache from getting out of hand, by clearing it
after every plot.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
 trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -83,7 +83,7 @@
 from matplotlib.figure import Figure
 from matplotlib.font_manager import findfont
 from matplotlib.ft2font import FT2Font, LOAD_DEFAULT
-from matplotlib.mathtext import math_parse_s_ft2font
+from matplotlib.mathtext import MathTextParser
 from matplotlib.transforms import lbwh_to_bbox
 
 from _backend_agg import RendererAgg as _RendererAgg
@@ -125,8 +125,8 @@
 
 self.copy_from_bbox = self._renderer.copy_from_bbox
 self.restore_region = self._renderer.restore_region
+ self.mathtext_parser = MathTextParser('Agg')
 
-
 self.bbox = lbwh_to_bbox(0,0, self.width, self.height)
 if __debug__: verbose.report('RendererAgg.__init__ done',
 'debug-annoying')
@@ -173,7 +173,7 @@
 """
 if __debug__: verbose.report('RendererAgg.draw_mathtext',
 'debug-annoying')
- width, height, fonts, used_characters = math_parse_s_ft2font(
+ width, height, fonts, used_characters = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 
 if angle == 90:
@@ -230,7 +230,7 @@
 return n,m
 
 if ismath:
- width, height, fonts, used_characters = math_parse_s_ft2font(
+ width, height, fonts, used_characters = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 return width, height
 font = self._get_agg_font(prop)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -16,7 +16,7 @@
 from matplotlib.cbook import enumerate, is_string_like, exception_to_str
 from matplotlib.figure import Figure
 from matplotlib.ft2font import FT2Font
-from matplotlib.mathtext import math_parse_s_ft2font
+from matplotlib.mathtext import MathTextParser
 
 
 from _backend_agg import RendererAgg as _RendererAgg
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -38,7 +38,7 @@
 FigureManagerBase, FigureCanvasBase
 from matplotlib.cbook import enumerate, izip
 from matplotlib.figure import Figure
-from matplotlib.mathtext import math_parse_s_cairo
+from matplotlib.mathtext import MathTextParser
 from matplotlib.transforms import Bbox
 from matplotlib.font_manager import ttfFontProperty
 from matplotlib import rcParams
@@ -92,8 +92,8 @@
 self.dpi = dpi
 self.text_ctx = cairo.Context (
 cairo.ImageSurface (cairo.FORMAT_ARGB32,1,1))
+ self.mathtext_parser = MathTextParser('Cairo')
 
-
 def set_ctx_from_surface (self, surface):
 self.ctx = cairo.Context (surface)
 self.ctx.save() # restore, save - when call new_gc()
@@ -304,7 +304,7 @@
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 
 ctx = gc.ctx
- width, height, glyphs, rects = math_parse_s_cairo(
+ width, height, glyphs, rects = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 
 ctx.save()
@@ -352,7 +352,7 @@
 def get_text_width_height(self, s, prop, ismath):
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 if ismath:
- width, height, fonts, used_characters = math_parse_s_cairo(
+ width, height, fonts, used_characters = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 return width, height
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -24,7 +24,7 @@
 FigureManagerBase, FigureCanvasBase
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.figure import Figure
-from matplotlib.mathtext import math_parse_s_ft2font
+from matplotlib.mathtext import MathTextParser
 
 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
 
@@ -71,6 +71,7 @@
 self.gtkDA = gtkDA
 self.dpi = dpi
 self._cmap = gtkDA.get_colormap()
+ self.mathtext_parser = MathTextParser("Agg")
 
 def set_pixmap (self, pixmap):
 self.gdkDrawable = pixmap
@@ -198,7 +199,7 @@
 
 
 def _draw_mathtext(self, gc, x, y, s, prop, angle):
- width, height, fonts, used_characters = math_parse_s_ft2font(
+ width, height, fonts, used_characters = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 
 if angle==90:
@@ -341,7 +342,7 @@
 
 def get_text_width_height(self, s, prop, ismath):
 if ismath:
- width, height, fonts, used_characters = math_parse_s_ft2font(
+ width, height, fonts, used_characters = self.mathtext_parser.parse(
 s, self.dpi.get(), prop)
 return width, height
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -29,7 +29,7 @@
 from matplotlib.dviread import Dvi
 from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, \
 LOAD_NO_HINTING, KERNING_UNFITTED
-from matplotlib.mathtext import math_parse_s_pdf
+from matplotlib.mathtext import MathTextParser
 from matplotlib.transforms import Bbox
 from matplotlib import ttconv
 
@@ -1032,6 +1032,7 @@
 self.encode_string = self.encode_string_type3
 else:
 self.encode_string = self.encode_string_type42
+ self.mathtext_parser = MathTextParser("Pdf")
 
 def finalize(self):
 self.gc.finalize()
@@ -1219,7 +1220,7 @@
 def draw_mathtext(self, gc, x, y, s, prop, angle):
 # TODO: fix positioning and encoding
 width, height, glyphs, rects, used_characters = \
- math_parse_s_pdf(s, 72, prop)
+ self.mathtext_parser.parse(s, 72, prop)
 self.merge_used_characters(used_characters)
 
 # When using Type 3 fonts, we can't use character codes higher
@@ -1466,7 +1467,7 @@
 
 if ismath:
 w, h, glyphs, rects, used_characters = \
- math_parse_s_pdf(s, 72, prop)
+ self.mathtext_parser.parse(s, 72, prop)
 
 elif rcParams['pdf.use14corefonts']:
 font = self._get_font_afm(prop)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -21,7 +21,7 @@
 from matplotlib.font_manager import findfont
 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
 from matplotlib.ttconv import convert_ttf_to_ps
-from matplotlib.mathtext import math_parse_s_ps
+from matplotlib.mathtext import MathTextParser
 from matplotlib.text import Text
 
 from matplotlib.transforms import get_vec6_scales
@@ -144,6 +144,7 @@
 self.fontd = {}
 self.afmfontd = {}
 self.used_characters = {}
+ self.mathtext_parser = MathTextParser("PS")
 
 def track_characters(self, font, s):
 """Keeps track of which characters are required from
@@ -277,8 +278,8 @@
 return w, h
 
 if ismath:
- width, height, pswriter, used_characters = math_parse_s_ps(
- s, 72, prop)
+ width, height, pswriter, used_characters = \
+ self.mathtext_parser.parse(s, 72, prop)
 return width, height
 
 if rcParams['ps.useafm']:
@@ -814,7 +815,7 @@
 self._pswriter.write("% mathtext\n")
 
 width, height, pswriter, used_characters = \
- math_parse_s_ps(s, 72, prop)
+ self.mathtext_parser.parse(s, 72, prop)
 self.merge_used_characters(used_characters)
 self.set_color(*gc.get_rgb())
 thetext = pswriter.getvalue()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -10,7 +10,7 @@
 FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.figure import Figure
-from matplotlib.mathtext import math_parse_s_ft2font
+from matplotlib.mathtext import MathTextParser
 from matplotlib.widgets import SubplotTool
 
 import qt
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -10,7 +10,7 @@
 FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.figure import Figure
-from matplotlib.mathtext import math_parse_s_ft2font
+from matplotlib.mathtext import MathTextParser
 from matplotlib.widgets import SubplotTool
 
 from PyQt4 import QtCore, QtGui
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -9,7 +9,7 @@
 from matplotlib.figure import Figure
 from matplotlib.font_manager import findfont, FontProperties
 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
-from matplotlib.mathtext import math_parse_s_ft2font_svg
+from matplotlib.mathtext import MathTextParser
 
 from xml.sax.saxutils import escape as escape_xml_text
 
@@ -40,6 +40,7 @@
 self._imaged = {}
 self._clipd = {}
 self._char_defs = {}
+ self.mathtext_parser = MathTextParser('SVG')
 svgwriter.write(svgProlog%(width,height,width,height))
 
 def _draw_svg_element(self, element, details, gc, rgbFace):
@@ -338,7 +339,7 @@
 Draw math text using matplotlib.mathtext
 """
 width, height, svg_elements, used_characters = \
- math_parse_s_ft2font_svg(s, 72, prop)
+ self.mathtext_parser.parse(s, 72, prop)
 svg_glyphs = svg_elements.svg_glyphs
 svg_rects = svg_elements.svg_rects
 color = rgb2hex(gc.get_rgb())
@@ -428,7 +429,7 @@
 def get_text_width_height(self, s, prop, ismath):
 if ismath:
 width, height, trash, used_characters = \
- math_parse_s_ft2font_svg(s, 72, prop)
+ self.mathtext_parser.parse(s, 72, prop)
 return width, height
 font = self._get_font(prop)
 font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 15:13:49 UTC (rev 3721)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月21日 15:19:04 UTC (rev 3722)
@@ -532,7 +532,7 @@
 slanted = slanted
 )
 
- self.glyphd[key] = Bunch(
+ result = self.glyphd[key] = Bunch(
 font = font,
 fontsize = fontsize,
 postscript_name = font.postscript_name,
@@ -542,7 +542,7 @@
 glyph = glyph,
 offset = offset
 )
- return self.glyphd[key]
+ return result
 
 def get_xheight(self, font, fontsize, dpi):
 cached_font = self._get_font(font)
@@ -2343,7 +2343,7 @@
 ##############################################################################
 # MAIN
 
-class math_parse_s_ft2font_common:
+class MathTextParser:
 """
 Parse the math expression s, return the (bbox, fonts) tuple needed
 to render it.
@@ -2352,40 +2352,38 @@
 
 return is width, height, fonts
 """
- major, minor1, minor2, tmp, tmp = sys.version_info
- if major==2 and minor1==2:
- raise SystemExit('mathtext broken on python2.2. We hope to get this fixed soon')
-
 _parser = None
-
+ 
 _backend_mapping = {
 'Agg' : MathtextBackendAgg,
 'PS' : MathtextBackendPs,
- 'PDF' : MathtextBackendPdf,
+ 'Pdf' : MathtextBackendPdf,
 'SVG' : MathtextBackendSvg,
 'Cairo' : MathtextBackendCairo
 }
 
 def __init__(self, output):
- self.output = output
- self.cache = {}
+ self._output = output
+ self._cache = {}
 
- def __call__(self, s, dpi, prop):
+ def parse(self, s, dpi, prop):
 cacheKey = (s, dpi, hash(prop))
- if self.cache.has_key(cacheKey):
- result = self.cache[cacheKey]
+ result = self._cache.get(cacheKey)
+ if result is not None:
 return result
 
- if self.output == 'PS' and rcParams['ps.useafm']:
+ if self._output == 'PS' and rcParams['ps.useafm']:
 font_output = StandardPsFonts(prop)
 else:
- backend = self._backend_mapping[self.output]()
+ backend = self._backend_mapping[self._output]()
 if rcParams['mathtext.use_cm']:
 font_output = BakomaFonts(prop, backend)
 else:
 font_output = UnicodeFonts(prop, backend)
 
 fontsize = prop.get_size_in_points()
+ # This is a class variable so we don't rebuild the parser
+ # with each request.
 if self._parser is None:
 self.__class__._parser = Parser()
 box = self._parser.parse(s, font_output, fontsize, dpi)
@@ -2395,7 +2393,7 @@
 font_output.set_canvas_size(w, h)
 ship(2, 2, box)
 result = font_output.get_results()
- self.cache[cacheKey] = result
+ self._cache[cacheKey] = result
 # Free up the transient data structures
 self._parser.clear()
 # Remove a cyclical reference
@@ -2403,8 +2401,8 @@
 
 return result
 
-math_parse_s_ft2font = math_parse_s_ft2font_common('Agg')
-math_parse_s_ft2font_svg = math_parse_s_ft2font_common('SVG')
-math_parse_s_ps = math_parse_s_ft2font_common('PS')
-math_parse_s_pdf = math_parse_s_ft2font_common('PDF')
-math_parse_s_cairo = math_parse_s_ft2font_common('Cairo')
+# math_parse_s_ft2font = math_parse_s_ft2font_common('Agg')
+# math_parse_s_ft2font_svg = math_parse_s_ft2font_common('SVG')
+# math_parse_s_ps = math_parse_s_ft2font_common('PS')
+# math_parse_s_pdf = math_parse_s_ft2font_common('PDF')
+# math_parse_s_cairo = math_parse_s_ft2font_common('Cairo')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3721
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3721&view=rev
Author: mdboom
Date: 2007年08月21日 08:13:49 -0700 (2007年8月21日)
Log Message:
-----------
Fix capitalization of "Pdf", which must match that in matplotlib/__init__.py
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mpltraits.py
Modified: trunk/matplotlib/lib/matplotlib/config/mpltraits.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月20日 18:52:38 UTC (rev 3720)
+++ trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月21日 15:13:49 UTC (rev 3721)
@@ -30,7 +30,7 @@
 'agg': 'Agg',
 'cairo': 'Cairo',
 'ps': 'PS',
- 'pdf': 'PDF',
+ 'pdf': 'Pdf',
 'svg': 'SVG',
 'template': 'Template' }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年08月20日 18:52:40
Revision: 3720
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3720&view=rev
Author: dsdale
Date: 2007年08月20日 11:52:38 -0700 (2007年8月20日)
Log Message:
-----------
fix verbose reporting with traited config
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/setup.py
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2007年08月20日 16:11:29 UTC (rev 3719)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2007年08月20日 18:52:38 UTC (rev 3720)
@@ -711,6 +711,8 @@
 #print "importing from reorganized config system!"
 try:
 from config import rcParams, rcdefaults, mplConfig, save_config
+ verbose.set_level(rcParams['verbose.level'])
+ verbose.set_fileo(rcParams['verbose.fileo'])
 except:
 from config import rcParams, rcdefaults
 
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py	2007年08月20日 16:11:29 UTC (rev 3719)
+++ trunk/matplotlib/setup.py	2007年08月20日 18:52:38 UTC (rev 3720)
@@ -64,7 +64,7 @@
 try: import setuptools
 except ImportError:
 raise SystemExit("""\
-matplotlib requires setuptools for installation. Visit:
+matplotlib requires setuptools for installation with python-2.3. Visit:
 http://cheeseshop.python.org/pypi/setuptools
 for installation instructions for the proper version of setuptools for your
 system. If this is your first time upgrading matplotlib with the new
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月20日 16:11:35
Revision: 3719
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3719&view=rev
Author: mdboom
Date: 2007年08月20日 09:11:29 -0700 (2007年8月20日)
Log Message:
-----------
Change mathtext.* rcParams so they accept a string which is a set of
arguments to the FontProperties constructor. This has been added to
both the classic and traits based configuration frameworks.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/config/mpltraits.py
 trunk/matplotlib/lib/matplotlib/config/rcsetup.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
 trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
 trunk/matplotlib/lib/matplotlib/rcsetup.py
 trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -161,12 +161,12 @@
 dvipnghack = T.false
 
 class mathtext(TConfig):
- cal = T.Trait('cursive', 'cursive', 'normal', 'normal')
- rm = T.Trait('serif', 'serif', 'normal', 'normal')
- tt = T.Trait('monospace', 'monospace', 'normal', 'normal')
- it = T.Trait('serif', 'serif', 'normal', 'italic')
- bf = T.Trait('serif', 'serif', 'bold', 'normal')
- sf = T.Trait('sans-serif', 'sans-serif', 'normal', 'normal')
+ cal = T.Trait("['cursive']", mplT.FontPropertiesHandler())
+ rm = T.Trait("['serif']", mplT.FontPropertiesHandler())
+ tt = T.Trait("['monospace']", mplT.FontPropertiesHandler())
+ it = T.Trait("['serif'], style='oblique'", mplT.FontPropertiesHandler())
+ bf = T.Trait("['serif'], weight='bold'", mplT.FontPropertiesHandler())
+ sf = T.Trait("['sans-serif']", mplT.FontPropertiesHandler())
 use_cm = T.true
 fallback_to_cm = T.true
 
Modified: trunk/matplotlib/lib/matplotlib/config/mpltraits.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/config/mpltraits.py	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -144,3 +144,65 @@
 'hsv', 'hsv_r', 'jet', 'jet_r', 'pink', 'pink_r', 
 'prism', 'prism_r', 'spectral', 'spectral_r', 'spring', 
 'spring_r', 'summer', 'summer_r', 'winter', 'winter_r']
+
+class FontPropertiesHandler(T.TraitHandler):
+ class FontPropertiesProxy:
+ # In order to build a FontProperties object, various rcParams must
+ # already be known in order to set default values. That means a
+ # FontProperties object can not be created from a config file,
+ # since it depends on other values in the same config file. This
+ # proxy class is used as a temporary storage area for the settings
+ # in the config file, and the full FontProperties class is created
+ # only when the class is first used. It is defined here rather than
+ # in font_manager.py to avoid a cyclical import.
+ def __init__(self,
+ family = None,
+ style = None,
+ variant= None,
+ weight = None,
+ stretch= None,
+ size = None,
+ fname = None, # if this is set, it's a hardcoded filename to use
+ ):
+ self.__family = family
+ self.__style = style
+ self.__variant = variant
+ self.__weight = weight
+ self.__stretch = stretch
+ self.__size = size
+ self.__fname = fname
+
+ self.__child = None
+
+ def __get_child(self):
+ if self.__child is None:
+ from matplotlib.font_manager import FontProperties
+ self.__child = FontProperties(
+ family = self.__family,
+ style = self.__style,
+ variant = self.__variant,
+ weight = self.__weight,
+ stretch = self.__stretch,
+ size = self.__size,
+ fname = self.__fname)
+ return self.__child
+
+ def __getattr__(self, attr):
+ return getattr(self.__get_child(), attr)
+
+ def validate(self, object, name, value):
+ from matplotlib.font_manager import FontProperties
+ if isinstance(value, FontProperties):
+ return value
+ if is_string_like(value):
+ try:
+ proxy = eval("FontProperties(%s)" % value,
+ {}, {'FontProperties': self.FontPropertiesProxy})
+ except:
+ pass
+ else:
+ return proxy
+ self.error(object, name, value)
+ 
+ def info(self):
+ return 'Represents a set of font properties. Must be a FontProperties object or a string containing the parameters to the FontProperties constructor.'
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -198,12 +198,64 @@
 except ValueError:
 raise ValueError('not a valid font size')
 
-def validate_mathtext_font(s):
- s = eval(s)
- if type(s) in (list, tuple) and len(s) == 3:
- return s
- raise ValueError('Mathtext font specifier must be a 3-tuple of (family, weight, style)')
+class FontPropertiesProxy:
+ # In order to build a FontProperties object, various rcParams must
+ # already be known in order to set default values. That means a
+ # FontProperties object can not be created from a config file,
+ # since it depends on other values in the same config file. This
+ # proxy class is used as a temporary storage area for the settings
+ # in the config file, and the full FontProperties class is created
+ # only when the class is first used. It is defined here rather than
+ # in font_manager.py to avoid a cyclical import.
+ def __init__(self,
+ family = None,
+ style = None,
+ variant= None,
+ weight = None,
+ stretch= None,
+ size = None,
+ fname = None, # if this is set, it's a hardcoded filename to use
+ ):
+ self.__family = family
+ self.__style = style
+ self.__variant = variant
+ self.__weight = weight
+ self.__stretch = stretch
+ self.__size = size
+ self.__fname = fname
+
+ self.__child = None
+
+ def __get_child(self):
+ if self.__child is None:
+ from font_manager import FontProperties
+ self.__child = FontProperties(
+ family = self.__family,
+ style = self.__style,
+ variant = self.__variant,
+ weight = self.__weight,
+ stretch = self.__stretch,
+ size = self.__size,
+ fname = self.__fname)
+ return self.__child
+
+ def __getattr__(self, attr):
+ return getattr(self.__get_child(), attr)
 
+def validate_font_properties(s):
+ parsed = False
+ try:
+ prop = eval(u'FontProperties(%s)' % s,
+ {}, {'FontProperties': FontPropertiesProxy})
+ except:
+ pass
+ else:
+ parsed = isinstance(prop, FontPropertiesProxy)
+ if not parsed:
+ raise ValueError(
+ 'Mathtext font specifier must be a set of arguments to the FontProperty constructor.')
+ return prop
+ 
 validate_markup = ValidateInStrings(
 'markup', 
 ['plain', 'tex'],
@@ -366,12 +418,12 @@
 'text.fontsize' : ['medium', validate_fontsize],
 'text.markup' : ['plain', validate_markup],
 
- 'mathtext.cal' : [('cursive', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.rm' : [('serif', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.tt' : [('monospace', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.it' : [('serif', 'normal', 'italic'), validate_mathtext_font],
- 'mathtext.bf' : [('serif', 'bold', 'normal'), validate_mathtext_font],
- 'mathtext.sf' : [('sans-serif', 'normal', 'normal'), validate_mathtext_font],
+ 'mathtext.cal' : [FontPropertiesProxy(['cursive']), validate_font_properties],
+ 'mathtext.rm' : [FontPropertiesProxy(['serif']), validate_font_properties],
+ 'mathtext.tt' : [FontPropertiesProxy(['monospace']), validate_font_properties],
+ 'mathtext.it' : [FontPropertiesProxy(['serif'], style='oblique'), validate_font_properties],
+ 'mathtext.bf' : [FontPropertiesProxy(['serif'], weight='bold'), validate_font_properties],
+ 'mathtext.sf' : [FontPropertiesProxy(['sans-serif']), validate_font_properties],
 'mathtext.use_cm' : [True, validate_bool],
 'mathtext.fallback_to_cm' : [True, validate_bool],
 
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -686,9 +686,7 @@
 TruetypeFonts.__init__(self, *args, **kwargs)
 if not len(self.fontmap):
 for texfont in "cal rm tt it bf sf".split():
- setting = rcParams['mathtext.' + texfont]
- family, weight, style = setting
- prop = FontProperties(family=family, weight=weight, style=style)
+ prop = rcParams['mathtext.' + texfont]
 font = findfont(prop)
 self.fontmap[texfont] = font
 
Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -150,7 +150,7 @@
 #text.dvipnghack : False # some versions of dvipng don't handle
 # alpha channel properly. Use True to correct and flush
 # ~/.matplotlib/tex.cache before testing
-#text.markup : 'plain' # Affects how text, such as titles and lables, are
+#text.markup : 'plain' # Affects how text, such as titles and labels, are
 # interpreted by default.
 # 'plain': As plain, unformatted text
 				# 'tex': As TeX-like text. Text between $'s will be
@@ -160,16 +160,16 @@
 				# processing.
 
 # The following settings allow you to select the fonts in math mode.
-# They map from a TeX font name to a 3-tuple of the form:
-# (family, weight, style)
+# They map from a TeX font name to a set of arguments for the FontProperties constructor.
+# (See FontProperties for more details).
 # These settings are only used if mathtext.use_cm is False, otherwise, the
 # Bakoma TeX Computer Modern fonts are used.
-#mathtext.cal : (['cursive'], 'normal', 'normal')
-#mathtext.rm : (['serif'], 'normal', 'normal')
-#mathtext.tt : (['monospace'], 'normal', 'normal')
-#mathtext.it : (['serif'], 'normal', 'oblique')
-#mathtext.bf : (['serif'], 'bold', 'normal')
-#mathtext.sf : (['sans-serif'], 'normal', 'normal')
+#mathtext.cal : ['cursive']
+#mathtext.rm : ['serif']
+#mathtext.tt : ['monospace']
+#mathtext.it : ['serif'], style='oblique'
+#mathtext.bf : ['serif'], weight='bold'
+#mathtext.sf : ['sans-serif']
 #mathtext.use_cm : True
 #mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern
 			 # fonts when a symbol can not be found in one of 
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -198,12 +198,64 @@
 except ValueError:
 raise ValueError('not a valid font size')
 
-def validate_mathtext_font(s):
- s = eval(s)
- if type(s) in (list, tuple) and len(s) == 3:
- return s
- raise ValueError('Mathtext font specifier must be a 3-tuple of (family, weight, style)')
+class FontPropertiesProxy:
+ # In order to build a FontProperties object, various rcParams must
+ # already be known in order to set default values. That means a
+ # FontProperties object can not be created from a config file,
+ # since it depends on other values in the same config file. This
+ # proxy class is used as a temporary storage area for the settings
+ # in the config file, and the full FontProperties class is created
+ # only when the class is first used. It is defined here rather than
+ # in font_manager.py to avoid a cyclical import.
+ def __init__(self,
+ family = None,
+ style = None,
+ variant= None,
+ weight = None,
+ stretch= None,
+ size = None,
+ fname = None, # if this is set, it's a hardcoded filename to use
+ ):
+ self.__family = family
+ self.__style = style
+ self.__variant = variant
+ self.__weight = weight
+ self.__stretch = stretch
+ self.__size = size
+ self.__fname = fname
+
+ self.__child = None
+
+ def __get_child(self):
+ if self.__child is None:
+ from font_manager import FontProperties
+ self.__child = FontProperties(
+ family = self.__family,
+ style = self.__style,
+ variant = self.__variant,
+ weight = self.__weight,
+ stretch = self.__stretch,
+ size = self.__size,
+ fname = self.__fname)
+ return self.__child
+
+ def __getattr__(self, attr):
+ return getattr(self.__get_child(), attr)
 
+def validate_font_properties(s):
+ parsed = False
+ try:
+ prop = eval(u'FontProperties(%s)' % s,
+ {}, {'FontProperties': FontPropertiesProxy})
+ except:
+ pass
+ else:
+ parsed = isinstance(prop, FontPropertiesProxy)
+ if not parsed:
+ raise ValueError(
+ 'Mathtext font specifier must be a set of arguments to the FontProperty constructor.')
+ return prop
+ 
 validate_markup = ValidateInStrings(
 'markup', 
 ['plain', 'tex'],
@@ -366,12 +418,12 @@
 'text.fontsize' : ['medium', validate_fontsize],
 'text.markup' : ['plain', validate_markup],
 
- 'mathtext.cal' : [('cursive', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.rm' : [('serif', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.tt' : [('monospace', 'normal', 'normal'), validate_mathtext_font],
- 'mathtext.it' : [('serif', 'normal', 'italic'), validate_mathtext_font],
- 'mathtext.bf' : [('serif', 'bold', 'normal'), validate_mathtext_font],
- 'mathtext.sf' : [('sans-serif', 'normal', 'normal'), validate_mathtext_font],
+ 'mathtext.cal' : [FontPropertiesProxy(['cursive']), validate_font_properties],
+ 'mathtext.rm' : [FontPropertiesProxy(['serif']), validate_font_properties],
+ 'mathtext.tt' : [FontPropertiesProxy(['monospace']), validate_font_properties],
+ 'mathtext.it' : [FontPropertiesProxy(['serif'], style='oblique'), validate_font_properties],
+ 'mathtext.bf' : [FontPropertiesProxy(['serif'], weight='bold'), validate_font_properties],
+ 'mathtext.sf' : [FontPropertiesProxy(['sans-serif']), validate_font_properties],
 'mathtext.use_cm' : [True, validate_bool],
 'mathtext.fallback_to_cm' : [True, validate_bool],
 
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template	2007年08月20日 12:47:45 UTC (rev 3718)
+++ trunk/matplotlib/matplotlibrc.template	2007年08月20日 16:11:29 UTC (rev 3719)
@@ -150,7 +150,7 @@
 #text.dvipnghack : False # some versions of dvipng don't handle
 # alpha channel properly. Use True to correct and flush
 # ~/.matplotlib/tex.cache before testing
-#text.markup : 'plain' # Affects how text, such as titles and lables, are
+#text.markup : 'plain' # Affects how text, such as titles and labels, are
 # interpreted by default.
 # 'plain': As plain, unformatted text
 				# 'tex': As TeX-like text. Text between $'s will be
@@ -160,16 +160,16 @@
 				# processing.
 
 # The following settings allow you to select the fonts in math mode.
-# They map from a TeX font name to a 3-tuple of the form:
-# (family, weight, style)
+# They map from a TeX font name to a set of arguments for the FontProperties constructor.
+# (See FontProperties for more details).
 # These settings are only used if mathtext.use_cm is False, otherwise, the
 # Bakoma TeX Computer Modern fonts are used.
-#mathtext.cal : (['cursive'], 'normal', 'normal')
-#mathtext.rm : (['serif'], 'normal', 'normal')
-#mathtext.tt : (['monospace'], 'normal', 'normal')
-#mathtext.it : (['serif'], 'normal', 'oblique')
-#mathtext.bf : (['serif'], 'bold', 'normal')
-#mathtext.sf : (['sans-serif'], 'normal', 'normal')
+#mathtext.cal : ['cursive']
+#mathtext.rm : ['serif']
+#mathtext.tt : ['monospace']
+#mathtext.it : ['serif'], style='oblique'
+#mathtext.bf : ['serif'], weight='bold'
+#mathtext.sf : ['sans-serif']
 #mathtext.use_cm : True
 #mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern
 			 # fonts when a symbol can not be found in one of 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3718
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3718&view=rev
Author: dsdale
Date: 2007年08月20日 05:47:45 -0700 (2007年8月20日)
Log Message:
-----------
sync tconfig.py with sources in ipython1
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/tconfig.py
Modified: trunk/matplotlib/lib/matplotlib/config/tconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/tconfig.py	2007年08月20日 12:47:42 UTC (rev 3717)
+++ trunk/matplotlib/lib/matplotlib/config/tconfig.py	2007年08月20日 12:47:45 UTC (rev 3718)
@@ -370,8 +370,6 @@
 if config is None:
 config = mkConfigObj(None)
 
- 
-
 # Validate the set of scalars ...
 my_scalars = set(get_scalars(self))
 cf_scalars = set(config.scalars)
@@ -603,7 +601,7 @@
 
 This method, in contrast with write(), updates the .fconfCombined
 object with the *entire* .tconf instance, and then writes it out to
- disk. This method is thus useful for generating files that contain an
+ disk. This method is thus useful for generating files that have a
 self-contained, non-hierarchical file.
 
 :Keywords:
@@ -615,12 +613,12 @@
 if filename is not None:
 fileObj = open(filename,'w')
 self.fconfUpdate(self.fconfCombined,self.tconf)
- out = self.fconf.write(fileObj)
+ out = self.fconfCombined.write(fileObj)
 fileObj.close()
 return out
 else:
 self.fconfUpdate(self.fconfCombined,self.tconf)
- return self.fconf.write()
+ return self.fconfCombined.write()
 
 def tconfStr(self):
 return str(self.tconf)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3717
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3717&view=rev
Author: mdboom
Date: 2007年08月20日 05:47:42 -0700 (2007年8月20日)
Log Message:
-----------
Take a version check out of the method call. Thanks to Fernando Perez.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py	2007年08月20日 12:46:53 UTC (rev 3716)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py	2007年08月20日 12:47:42 UTC (rev 3717)
@@ -29,12 +29,14 @@
 
 
 class RendererGTKCairo (backend_cairo.RendererCairo):
- def set_pixmap (self, pixmap):
- if gtk.pygtk_version >= (2,7,0):
+ if gtk.pygtk_version >= (2,7,0):
+ def set_pixmap (self, pixmap):
 self.ctx = pixmap.cairo_create()
- else:
+ self.ctx.save() # restore, save - when call new_gc()
+ else:
+ def set_pixmap (self, pixmap):
 self.ctx = cairo.gtk.gdk_cairo_create (pixmap)
- self.ctx.save() # restore, save - when call new_gc()
+ self.ctx.save() # restore, save - when call new_gc()
 
 
 class FigureCanvasGTKCairo(FigureCanvasGTK):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 120

<< < 1 2 3 4 5 > >> (Page 2 of 5)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /