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)
|
|
__repr__(self)
|
ConfigBase |
Create ()
Create and return a new global config object. (Static method)
|
bool |
DeleteAll (self)
Delete the whole underlying object (disk file, registry key, ...)
primarly intended for use by deinstallation routine. |
bool |
DeleteEntry (self,
key,
deleteGroupIfEmpty)
Deletes the specified entry and the group it belongs to if it was the
last key in it and the second parameter is True |
bool |
DeleteGroup (self,
key)
Delete the group (with all subgroups) |
|
DontCreateOnDemand ()
Should Get() try to create a new log object if there isn't a current
one? (Static method)
|
bool |
Exists (self,
name)
Returns True if either a group or an entry with a given name exists |
String |
ExpandEnvVars (self,
str)
Expand any environment variables in str and return the result |
bool |
Flush (self,
currentOnly)
permanently writes all changes |
ConfigBase |
Get (createOnDemand)
Returns the current global config object, creating one if neccessary. (Static method)
|
String |
GetAppName(self)
|
int |
GetEntryType (self,
name)
Get the type of the entry. |
(more, value, index) |
GetFirstEntry ()
Allows enumerating the entries in the current group in a config
object. |
(more, value, index) |
GetFirstGroup ()
Allows enumerating the subgroups in a config object. |
(more, value, index) |
GetNextEntry (index)
Allows enumerating the entries in the current group in a config
object. |
(more, value, index) |
GetNextGroup (index)
Allows enumerating the subgroups in a config object. |
size_t |
GetNumberOfEntries (self,
recursive)
Get the number of entries in the current group, with or without its
subgroups. |
size_t |
GetNumberOfGroups (self,
recursive)
Get the number of subgroups in the current group, with or without its
subgroups. |
String |
GetPath (self)
Retrieve the current path (always as absolute path) |
long |
GetStyle(self)
|
String |
GetVendorName(self)
|
bool |
HasEntry (self,
name)
Returns True if the entry by this name exists |
bool |
HasGroup (self,
name)
Returns True if the group by this name exists |
bool |
IsExpandingEnvVars (self)
Are we currently expanding environment variables? |
bool |
IsRecordingDefaults (self)
Are we currently recording default values? |
String |
Read (self,
key,
defaultVal)
Returns the value of key if it exists, defaultVal otherwise. |
bool |
ReadBool (self,
key,
defaultVal)
Returns the value of key if it exists, defaultVal otherwise. |
double |
ReadFloat (self,
key,
defaultVal)
Returns the value of key if it exists, defaultVal otherwise. |
long |
ReadInt (self,
key,
defaultVal)
Returns the value of key if it exists, defaultVal otherwise. |
bool |
RenameEntry (self,
oldName,
newName)
Rename an entry. |
bool |
RenameGroup (self,
oldName,
newName)
Rename a group. |
ConfigBase |
Set (config)
Sets the global config object (the one returned by Get) and returns a
reference to the previous global config object. (Static method)
|
|
SetAppName(self,
appName)
|
|
SetExpandEnvVars (self,
doIt)
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 (self,
path)
Set current path: if the first character is '/', it's the absolute
path, otherwise it's a relative path. |
|
SetRecordDefaults (self,
doIt)
Set whether the config objec should record default values. |
|
SetStyle(self,
style)
|
|
SetVendorName(self,
vendorName)
|
bool |
Write (self,
key,
value)
write the value (return True on success) |
bool |
WriteBool (self,
key,
value)
write the value (return True on success) |
bool |
WriteFloat (self,
key,
value)
write the value (return True on success) |
bool |
WriteInt (self,
key,
value)
write the value (return True on success) |