|
From: <ef...@us...> - 2010-07-24 22:00:02
|
Revision: 8573
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8573&view=rev
Author: efiring
Date: 2010-07-24 21:59:55 +0000 (Sat, 24 Jul 2010)
Log Message:
-----------
rcParams: don't include deprecated keys.
Some other rc cleanups are included in this changeset.
Modified Paths:
--------------
branches/v1_0_maint/lib/matplotlib/__init__.py
branches/v1_0_maint/lib/matplotlib/rcsetup.py
Modified: branches/v1_0_maint/lib/matplotlib/__init__.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/__init__.py 2010-07-23 16:47:30 UTC (rev 8572)
+++ branches/v1_0_maint/lib/matplotlib/__init__.py 2010-07-24 21:59:55 UTC (rev 8573)
@@ -632,25 +632,50 @@
validate = dict([ (key, converter) for key, (default, converter) in \
defaultParams.iteritems() ])
+ msg_depr = "%s is deprecated and replaced with %s; please use the latter."
+ msg_depr_ignore = "%s is deprecated and ignored. Use %s"
def __setitem__(self, key, val):
try:
if key in _deprecated_map.keys():
alt = _deprecated_map[key]
- warnings.warn('%s is deprecated in matplotlibrc. Use %s \
-instead.'% (key, alt))
+ warnings.warn(self.msg_depr % (key, alt))
key = alt
elif key in _deprecated_ignore_map:
alt = _deprecated_ignore_map[key]
- warnings.warn('%s is deprecated. Use %s instead.'% (key, alt))
+ warnings.warn(self.msg_depr_ignore % (key, alt))
return
cval = self.validate[key](val)
dict.__setitem__(self, key, cval)
except KeyError:
raise KeyError('%s is not a valid rc parameter.\
-See rcParams.keys() for a list of valid parameters.'%key)
+See rcParams.keys() for a list of valid parameters.' % (key,))
+ def __getitem__(self, key):
+ if key in _deprecated_map.keys():
+ alt = _deprecated_map[key]
+ warnings.warn(self.msg_depr % (key, alt))
+ key = alt
+ elif key in _deprecated_ignore_map:
+ alt = _deprecated_ignore_map[key]
+ warnings.warn(self.msg_depr_ignore % (key, alt))
+ key = alt
+ return dict.__getitem__(self, key)
+ def keys(self):
+ """
+ Return sorted list of keys.
+ """
+ k = dict.keys(self)
+ k.sort()
+ return k
+
+ def values(self):
+ """
+ Return values in order of sorted keys.
+ """
+ return [self[k] for k in self.keys()]
+
def rc_params(fail_on_error=False):
'Return the default params updated from the values in the rc file'
@@ -810,12 +835,12 @@
for k,v in kwargs.items():
name = aliases.get(k) or k
key = '%s.%s' % (g, name)
- if key not in rcParams:
+ try:
+ rcParams[key] = v
+ except KeyError:
raise KeyError('Unrecognized key "%s" for group "%s" and name "%s"' %
(key, g, name))
- rcParams[key] = v
-
def rcdefaults():
"""
Restore the default rc params - the ones that were created at
Modified: branches/v1_0_maint/lib/matplotlib/rcsetup.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/rcsetup.py 2010-07-23 16:47:30 UTC (rev 8572)
+++ branches/v1_0_maint/lib/matplotlib/rcsetup.py 2010-07-24 21:59:55 UTC (rev 8573)
@@ -347,8 +347,8 @@
defaultParams = {
'backend' : ['Agg', validate_backend], # agg is certainly present
'backend_fallback' : [True, validate_bool], # agg is certainly present
- 'numerix' : ['obsolete', validate_numerix],
- 'maskedarray' : ['obsolete', validate_maskedarray], #to be removed
+ #'numerix' : ['obsolete', validate_numerix],
+ #'maskedarray' : ['obsolete', validate_maskedarray], #to be removed
'toolbar' : ['toolbar2', validate_toolbar],
'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached
'units' : [False, validate_bool],
@@ -385,7 +385,7 @@
'font.variant' : ['normal', str], #
'font.stretch' : ['normal', str], #
'font.weight' : ['normal', str], #
- 'font.size' : [12.0, validate_float], #
+ 'font.size' : [12, validate_float], # Base font size in points
'font.serif' : [['Bitstream Vera Serif', 'DejaVu Serif',
'New Century Schoolbook', 'Century Schoolbook L',
'Utopia', 'ITC Bookman', 'Bookman',
@@ -412,13 +412,16 @@
'text.latex.preamble' : [[''], validate_stringlist],
'text.latex.preview' : [False, validate_bool],
'text.dvipnghack' : [None, validate_bool_maybe_none],
- 'text.fontstyle' : ['normal', str],
- 'text.fontangle' : ['normal', str],
- 'text.fontvariant' : ['normal', str],
- 'text.fontweight' : ['normal', str],
- 'text.fontsize' : ['medium', validate_fontsize],
'text.hinting' : [True, validate_bool],
+ # The following are deprecated and replaced by, e.g., 'font.style'
+ #'text.fontstyle' : ['normal', str],
+ #'text.fontangle' : ['normal', str],
+ #'text.fontvariant' : ['normal', str],
+ #'text.fontweight' : ['normal', str],
+ #'text.fontsize' : ['medium', validate_fontsize],
+
+
'mathtext.cal' : ['cursive', validate_font_properties],
'mathtext.rm' : ['serif', validate_font_properties],
'mathtext.tt' : ['monospace', validate_font_properties],
@@ -483,9 +486,6 @@
'legend.shadow' : [False, validate_bool],
-
-
-
# tick properties
'xtick.major.size' : [4, validate_float], # major xtick size in points
'xtick.minor.size' : [2, validate_float], # minor xtick size in points
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|