Package wx :: Module _misc :: Class ConfigBase
[show private | hide private]
[frames | no frames]

Type ConfigBase

object --+
         |
        ConfigBase

Known Subclasses:
FileConfig

wx.ConfigBase class defines the basic interface of all config classes. It can not be used by itself (it is an abstract base class) and you will always use one of its derivations: wx.Config or wx.FileConfig.

wx.ConfigBase organizes the items in a tree-like structure, modeled after the Unix/Dos filesystem. There are groups that act like directories and entries, key/value pairs that act like files. There is always one current group given by the current path. As in the file system case, to specify a key in the config class you must use a path to it. Config classes also support the notion of the current group, which makes it possible to use relative paths.

Keys are pairs "key_name = value" where value may be of string, integer floating point or boolean, you can not store binary data without first encoding it as a string. For performance reasons items should be kept small, no more than a couple kilobytes.
Method Summary
  __init__(self)
  __del__(self, destroy)
__del__(self)
  __repr__(self)
  Create(*args, **kwargs)
Create() -> ConfigBase (Static method)
  DeleteAll(*args, **kwargs)
DeleteAll(self) -> bool
  DeleteEntry(*args, **kwargs)
DeleteEntry(self, String key, bool deleteGroupIfEmpty=True) -> bool
  DeleteGroup(*args, **kwargs)
DeleteGroup(self, String key) -> bool
  DontCreateOnDemand(*args, **kwargs)
DontCreateOnDemand() (Static method)
  Exists(*args, **kwargs)
Exists(self, String name) -> bool
  ExpandEnvVars(*args, **kwargs)
ExpandEnvVars(self, String str) -> String
  Flush(*args, **kwargs)
Flush(self, bool currentOnly=False) -> bool
  Get(*args, **kwargs)
Get(bool createOnDemand=True) -> ConfigBase (Static method)
  GetAppName(*args, **kwargs)
GetAppName(self) -> String
  GetEntryType(*args, **kwargs)
GetEntryType(self, String name) -> int
  GetFirstEntry(*args, **kwargs)
GetFirstEntry() -> (more, value, index)
  GetFirstGroup(*args, **kwargs)
GetFirstGroup() -> (more, value, index)
  GetNextEntry(*args, **kwargs)
GetNextEntry(long index) -> (more, value, index)
  GetNextGroup(*args, **kwargs)
GetNextGroup(long index) -> (more, value, index)
  GetNumberOfEntries(*args, **kwargs)
GetNumberOfEntries(self, bool recursive=False) -> size_t
  GetNumberOfGroups(*args, **kwargs)
GetNumberOfGroups(self, bool recursive=False) -> size_t
  GetPath(*args, **kwargs)
GetPath(self) -> String
  GetStyle(*args, **kwargs)
GetStyle(self) -> long
  GetVendorName(*args, **kwargs)
GetVendorName(self) -> String
  HasEntry(*args, **kwargs)
HasEntry(self, String name) -> bool
  HasGroup(*args, **kwargs)
HasGroup(self, String name) -> bool
  IsExpandingEnvVars(*args, **kwargs)
IsExpandingEnvVars(self) -> bool
  IsRecordingDefaults(*args, **kwargs)
IsRecordingDefaults(self) -> bool
  Read(*args, **kwargs)
Read(self, String key, String defaultVal=EmptyString) -> String
  ReadBool(*args, **kwargs)
ReadBool(self, String key, bool defaultVal=False) -> bool
  ReadFloat(*args, **kwargs)
ReadFloat(self, String key, double defaultVal=0.0) -> double
  ReadInt(*args, **kwargs)
ReadInt(self, String key, long defaultVal=0) -> long
  RenameEntry(*args, **kwargs)
RenameEntry(self, String oldName, String newName) -> bool
  RenameGroup(*args, **kwargs)
RenameGroup(self, String oldName, String newName) -> bool
  Set(*args, **kwargs)
Set(ConfigBase config) -> ConfigBase (Static method)
  SetAppName(*args, **kwargs)
SetAppName(self, String appName)
  SetExpandEnvVars(*args, **kwargs)
SetExpandEnvVars(self, bool doIt=True)
  SetPath(*args, **kwargs)
SetPath(self, String path)
  SetRecordDefaults(*args, **kwargs)
SetRecordDefaults(self, bool doIt=True)
  SetStyle(*args, **kwargs)
SetStyle(self, long style)
  SetVendorName(*args, **kwargs)
SetVendorName(self, String vendorName)
  Write(*args, **kwargs)
Write(self, String key, String value) -> bool
  WriteBool(*args, **kwargs)
WriteBool(self, String key, bool value) -> bool
  WriteFloat(*args, **kwargs)
WriteFloat(self, String key, double value) -> bool
  WriteInt(*args, **kwargs)
WriteInt(self, String key, long value) -> bool
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
int Type_Boolean = 2                                                                     
int Type_Float = 4                                                                     
int Type_Integer = 3                                                                     
int Type_String = 1                                                                     
int Type_Unknown = 0                                                                     

Instance Method Details

__del__(self, destroy=<built-in function delete_ConfigBase>)
(Destructor)

__del__(self)

DeleteAll(*args, **kwargs)

DeleteAll(self) -> bool

Delete the whole underlying object (disk file, registry key, ...) primarly intended for use by deinstallation routine.

DeleteEntry(*args, **kwargs)

DeleteEntry(self, String key, bool deleteGroupIfEmpty=True) -> bool

Deletes the specified entry and the group it belongs to if it was the last key in it and the second parameter is True

DeleteGroup(*args, **kwargs)

DeleteGroup(self, String key) -> bool

Delete the group (with all subgroups)

Exists(*args, **kwargs)

Exists(self, String name) -> bool

Returns True if either a group or an entry with a given name exists

ExpandEnvVars(*args, **kwargs)

ExpandEnvVars(self, String str) -> String

Expand any environment variables in str and return the result

Flush(*args, **kwargs)

Flush(self, bool currentOnly=False) -> bool

permanently writes all changes

GetAppName(*args, **kwargs)

GetAppName(self) -> String

GetEntryType(*args, **kwargs)

GetEntryType(self, String name) -> int

Get the type of the entry. Returns one of the wx.Config.Type_XXX values.

GetFirstEntry(*args, **kwargs)

GetFirstEntry() -> (more, value, index)

Allows enumerating the entries in the current group in a config object. Returns a tuple containing a flag indicating there are more items, the name of the current item, and an index to pass to GetNextGroup to fetch the next item.

GetFirstGroup(*args, **kwargs)

GetFirstGroup() -> (more, value, index)

Allows enumerating the subgroups in a config object. Returns a tuple containing a flag indicating there are more items, the name of the current item, and an index to pass to GetNextGroup to fetch the next item.

GetNextEntry(*args, **kwargs)

GetNextEntry(long index) -> (more, value, index)

Allows enumerating the entries in the current group in a config object. Returns a tuple containing a flag indicating there are more items, the name of the current item, and an index to pass to GetNextGroup to fetch the next item.

GetNextGroup(*args, **kwargs)

GetNextGroup(long index) -> (more, value, index)

Allows enumerating the subgroups in a config object. Returns a tuple containing a flag indicating there are more items, the name of the current item, and an index to pass to GetNextGroup to fetch the next item.

GetNumberOfEntries(*args, **kwargs)

GetNumberOfEntries(self, bool recursive=False) -> size_t

Get the number of entries in the current group, with or without its subgroups.

GetNumberOfGroups(*args, **kwargs)

GetNumberOfGroups(self, bool recursive=False) -> size_t

Get the number of subgroups in the current group, with or without its subgroups.

GetPath(*args, **kwargs)

GetPath(self) -> String

Retrieve the current path (always as absolute path)

GetStyle(*args, **kwargs)

GetStyle(self) -> long

GetVendorName(*args, **kwargs)

GetVendorName(self) -> String

HasEntry(*args, **kwargs)

HasEntry(self, String name) -> bool

Returns True if the entry by this name exists

HasGroup(*args, **kwargs)

HasGroup(self, String name) -> bool

Returns True if the group by this name exists

IsExpandingEnvVars(*args, **kwargs)

IsExpandingEnvVars(self) -> bool

Are we currently expanding environment variables?

IsRecordingDefaults(*args, **kwargs)

IsRecordingDefaults(self) -> bool

Are we currently recording default values?

Read(*args, **kwargs)

Read(self, String key, String defaultVal=EmptyString) -> String

Returns the value of key if it exists, defaultVal otherwise.

ReadBool(*args, **kwargs)

ReadBool(self, String key, bool defaultVal=False) -> bool

Returns the value of key if it exists, defaultVal otherwise.

ReadFloat(*args, **kwargs)

ReadFloat(self, String key, double defaultVal=0.0) -> double

Returns the value of key if it exists, defaultVal otherwise.

ReadInt(*args, **kwargs)

ReadInt(self, String key, long defaultVal=0) -> long

Returns the value of key if it exists, defaultVal otherwise.

RenameEntry(*args, **kwargs)

RenameEntry(self, String oldName, String newName) -> bool

Rename an entry. Returns False on failure (probably because the new name is already taken by an existing entry)

RenameGroup(*args, **kwargs)

RenameGroup(self, String oldName, String newName) -> bool

Rename a group. Returns False on failure (probably because the new name is already taken by an existing entry)

SetAppName(*args, **kwargs)

SetAppName(self, String appName)

SetExpandEnvVars(*args, **kwargs)

SetExpandEnvVars(self, bool doIt=True)

We can automatically expand environment variables in the config entries this option is on by default, you can turn it on/off at any time)

SetPath(*args, **kwargs)

SetPath(self, String path)

Set current path: if the first character is '/', it's the absolute path, otherwise it's a relative path. '..' is supported. If the strPath doesn't exist it is created.

SetRecordDefaults(*args, **kwargs)

SetRecordDefaults(self, bool doIt=True)

Set whether the config objec should record default values.

SetStyle(*args, **kwargs)

SetStyle(self, long style)

SetVendorName(*args, **kwargs)

SetVendorName(self, String vendorName)

Write(*args, **kwargs)

Write(self, String key, String value) -> bool

write the value (return True on success)

WriteBool(*args, **kwargs)

WriteBool(self, String key, bool value) -> bool

write the value (return True on success)

WriteFloat(*args, **kwargs)

WriteFloat(self, String key, double value) -> bool

write the value (return True on success)

WriteInt(*args, **kwargs)

WriteInt(self, String key, long value) -> bool

write the value (return True on success)

Static Method Details

Create(*args, **kwargs)

Create() -> ConfigBase

Create and return a new global config object. This function will create the "best" implementation of wx.Config available for the current platform.

DontCreateOnDemand(*args, **kwargs)

DontCreateOnDemand()

Should Get() try to create a new log object if there isn't a current one?

Get(*args, **kwargs)

Get(bool createOnDemand=True) -> ConfigBase

Returns the current global config object, creating one if neccessary.

Set(*args, **kwargs)

Set(ConfigBase config) -> ConfigBase

Sets the global config object (the one returned by Get) and returns a reference to the previous global config object.

Class Variable Details

Type_Boolean

Type:
int
Value:
2                                                                     

Type_Float

Type:
int
Value:
4                                                                     

Type_Integer

Type:
int
Value:
3                                                                     

Type_String

Type:
int
Value:
1                                                                     

Type_Unknown

Type:
int
Value:
0                                                                     

Generated by Epydoc 2.1 on Sun Feb 4 18:01:16 2007 http://epydoc.sf.net