From: John H. <jdh...@ac...> - 2005-02-08 13:34:42
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: Chris> I'd vote for Agg. Postscript is not the native format on Chris> OS-X that it is on other unices. Chris> Is there a way to make the default back-end system Chris> dependent on install? For a src distribution, you could write a postinstall script that does try/except on various GUIs and writes an rc file based on what it finds. This is basically what setup.py does in trying to figure out which backend to build, but doesn't transmit that information to rc -- perhaps it should. Although this would be fairly easy in a src distro, it would be fairly hard in the binary installer which you are trying to build. Alternatively, the backend importer could be a little smarter, and first try the default rc param and then loop over available backends trying to find a match, and issue a verbose report saying "dear newbie, I cannot import your default backend, please see http://blah." but still go ahead and launch something. I have mixed feelings about this -- the more magic we do the more complex it is to debug problems. Also, you have to be careful not to swallow tracebacks, eg pygtk import can fail even if pygtk has been installed on the system, and the user needs to know about this. But I am not totally opposed to it. In fact, I would definitely include it if it was an rc option. Eg, binary package makers like yourself could turn it on since you don't know the user configuration, and src distributors like me could turn it off, assuming people who build their own code can configure it like they like it. Power users want as little magic going on as possible -- new users usually want maximal magic. The function to look at is __init__.py in the main matplotlib tree. Currently we do def get_backend(): return rcParams['backend'] you would want to add an rc param, something like backend : ['TkAgg'] # try these if default fails backend.try = ['GTKAgg, 'WXAgg', 'Agg', 'PS] and then modify get_backend to iterate over these backends, trying to import something to test if it is available, issuing reports if the default backend fails. In the src distro, I always have the option of making backend.try the empty list, which would be the same as the current behavior. and JDH |