On Wed, Jul 18, 2007 at 11:24:09AM -0600, Brian Granger wrote:
> At some level though, configuration is a very different thing than an
> application's runtime API.  While they may be related (by exposing
> common functionality), not everything that can be configured would
> appear in a runtime API and vice-versa.  Also, some events that need
> to happen when an attribute is changed at runtime can't happen at
> config time as the application might not yet be up and running yet.

Well that easy to sort out. You can put a flag to the traits handler that
simply forbids it as long as the application is not running. Something
like:

    def if_app_running(callback):
        app = get_application() # get_application could be anything that
                                    # returns the current application
        def modified_callback(self, *args, **kwargs):
            if app.running:
                callback(self, *args, **kwargs)

        return modified_callback


    class ConfigurationObject(HasTraits):

        prompt = String('[%i]')

        @if_app_running
        def _prompt_changed(self):
            do whatever you want here

Gaƫl


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to