Abraham Schneider wrote:
What might be a cool extension on this idea, would be the ability to specify 'plugin' actions to add to the toolbar:
toolbar.buttons : (name, tooltip, image, function), (name, tooltip, image, function)
The difficulty would specifying which modules to load. One simple approach might be to have a directory called 'plugins', in which all modules automatically get loaded.
Note that this should be specifyable as a colon-separated search path where matplotlib can look for all available plugins. This allows users to extend their local installation with custom things which survive across system-wide upgrades.
I recently patched MayaVi to do exactly this with Filters and Modules (it's in the mayavi CVS already), and it's extremely useful.
In mayavi, any directory in the mayavi search path is scanned for a subdir called Filters/ and one called Modules/. Any .py file found there is added to the User submenu of Mayavi's main Filters and Modules menus. With this system, local user extensions become automatically available to the GUI. In scripts, they can be loaded with a prepended 'User.' string:
load_module('Glyphs') -> loads MayaVi's Glyphs module
load_module('User.Glyphs') -> loads a users's customized Glyphs module, without clashing with the system-wide one.
I think this approach is very useful, esp. because it allows research groups to have directories of common functionality useful to their projects, and individual users can still add their own particular Filters/Modules.