Revision: 3729
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3729&view=rev
Author:   mdboom
Date:     2007-08-22 12:38:08 -0700 (Wed, 22 Aug 2007)

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to