API Reference for Enthought Tool Suite 2.7.1
Mix of Traits and ConfigObj.
Provides:
- Coupling a Traits object to a ConfigObj one, so that changes to the Traited
instance propagate back into the ConfigObj.
- A declarative interface for describing configurations that automatically maps
to valid ConfigObj representations.
- From these descriptions, valid .conf files can be auto-generated, with class
docstrings and traits information used for initial auto-documentation.
- Hierarchical inclusion of files, so that a base config can be overridden only
in specific spots.
- Automatic GUI editing of configuration objects.
Notes:
The file creation policy is:
1. Creating a TConfigManager(FooConfig,'missingfile.conf') will work
fine, and 'missingfile.conf' will be created empty.
2. Creating TConfigManager(FooConfig,'OKfile.conf') where OKfile.conf has
include = 'missingfile.conf'
conks out with IOError.
My rationale is that creating top-level empty files is a common and
reasonable need, but that having invalid include statements should
raise an error right away, so people know immediately that their files
have gone stale.
TODO:
- Turn the currently interactive tests into proper doc/unit tests. Complete
docstrings.
- Write the real ipython1 config system using this. That one is more
complicated than either the MPL one or the fake 'ipythontest' that I wrote
here, and it requires solving the issue of declaring references to other
objects inside the config files.
- [Low priority] Write a custom TraitsUI view so that hierarchical
configurations provide nicer interactive editing. The automatic system is
remarkably good, but for very complex configurations having a nicely
organized view would be nice.
nullConf = mkConfigObj(None)
return an input string, commented out
Dump a Configobj instance to a string.
A modified version of textwrap.dedent, specialized for docstrings.
This version doesn't get confused by the first line of text having inconsistent indentation from the rest, which happens a lot in docstrings.
| Examples: | >>> s = ''' ... First line. ... More... ... End''' >>> print dedent(s) First line. More... End >>> s = '''First line ... More... ... End''' >>> print dedent(s) First line More... End |
|---|
input sc MUST be sorted!!!
Make a monitor for coupling TConfig instances to ConfigObj ones.
We must use a closure because Traits makes assumptions about the functions used with on_trait_change() that prevent the use of a callable instance.
Return sections for a TConf instance
Return scalars for a TConf class object
Return sections for a TConf class object
Find the filename attribute of a ConfigObj given a sub-section object.
Return a ConfigObj instance with our hardcoded conventions.
Use a simple factory that wraps our option choices for using ConfigObj. I'm hard-wiring certain choices here, so we'll always use instances with THESE choices.
| Parameters: |
|
|---|---|
| Keywords: |
|
Return scalars,sections for a given TConf instance.
Find the path to the root of a nested TConfig instance.
Set a value on a ConfigObj instance, arbitrarily deep.
Shorten a text input if necessary.
Write a TConfig instance to a given filename.
| Keywords: |
|
|---|
| Local name | Refers to |
|---|---|
| configobj | enthought.mayavi.config.configobj |
| isclass | inspect.isclass |
| os | os |
| StringIO | cStringIO.StringIO |
| textwrap | textwrap |
Copyright © 2002-2008 Enthought, Inc.