Ejemplo n.º 1
0
 def __init__(self, configClass, configFilename):
     self.rcman = TConfigManager(configClass, configFilename)
     self.rc = self.rcman.tconf
Ejemplo n.º 2
0
            self[key] = kwargs[key]


old_config_file = cutils.get_config_file(tconfig=False)
old_config_path = os.path.split(old_config_file)[0]
config_file = os.path.join(old_config_path, 'matplotlib.conf')

if os.path.exists(old_config_file) and not os.path.exists(config_file):
    CONVERT = True
else:
    config_file = cutils.get_config_file(tconfig=True)
    CONVERT = False

if DEBUG: print 'loading', config_file

configManager = TConfigManager(MPLConfig, config_file, filePriority=True)
mplConfig = configManager.tconf
mplConfigDefault = MPLConfig()

# TODO: move into traits validation
mplConfig.backend.ps.distiller.use = \
    checkdep.ps_distiller(mplConfig.backend.ps.distiller.use)
mplConfig.text.usetex = checkdep.usetex(mplConfig.text.usetex)


def save_config():
    """Save mplConfig customizations to current matplotlib.conf
    """
    configManager.write()

Ejemplo n.º 3
0
# We can save this to disk:
tconf2File(conf,'simple_default.conf',force=True)

# <demo> stop

# The GUI is auto-generated
conf.edit_traits()

# <demo> stop

# A TConfigManager handles the coupling of a TConfig object to a ConfigObj
# file, but the file can even start empty:
fname = 'simple2.conf'
!rm $fname

conf2 = TConfigManager(SimpleConfig,fname)

# This object starts 'empty', meaning it has no changes over the defaults
print conf2

# <demo> stop

# Now make some changes:
conf2.tconf.edit_traits()

# <demo> stop
# And write it out to disk, which only writes the changes
conf2.write()
!cat $fname

# <demo> stop