This was an attempt to do a direct translation from what I had in the 
"classic" rcsetup.py.  (The previous version in mplconfig.py was 
semantically incorrect.)  I had tested this with settings in my 
matplotlib.conf, but didn't realise that the default wasn't validated 
(and thus not interpreted into a FontPropertiesProxy object).

Darren Dale wrote:
> I am trying to work out some way to make rcdefaults() work with the traited 
> config. Along the way, I discovered this in mplconfig:
> 
>     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())
>         use_cm = T.true
>         fallback_to_cm = T.true
> 
> I dont think that will work. One of the highlights of the new config files is 
> that when a file says:
> 
> [mathtext]
> rm = ['serif', 'sans-serif']
> 
> you actually get a list, not a string, to pass to 
> mplT.FontPropertiesHandler().

Right.  But it works like:

rm = "['serif', 'sans-serif']"

I realize it's hacky.  The most obvious alternative is to expect a 
dictionary here, e.g.:

   rm = { 'family': ['serif'], 'style': 'oblique' }

But that's less like the FontProperties constructor.  My goal was to 
make specifying fonts as similar as possible to the FontProperties 
object so the user doesn't have to learn a new syntax.  Is there a 
better way to do this with Traits?  Can the user specify the arguments 
(with keyword arguments) to a constructor?

Cheers,
Mike

-------------------------------------------------------------------------
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to