v_sim.ConfigFile¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
The entry key of a configuration file has just been successfully parsed. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class v_sim.ConfigFile(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Structure used to define
v_sim.ConfigFileobjects.New in version 3.8.
- classmethod addKnownTag(tag)¶
- Parameters:
tag (
str) – a string (not nul or empty).
If parameter entries have a tag, they are ignored except if their tag has been declared using this method.
- classmethod exportComment(buffer, comment)¶
- Parameters:
buffer (
GLib.String) – the buffer to add a comment to.comment (
str) – a comment.
Append to buffer the given comment, using the current output style (raw text or XML as instance).
New in version 3.7.
- classmethod getDefaultFilename(kind)¶
- Parameters:
kind (
v_sim.ConfigFileKind) – an integer identifier.- Returns:
the filename of config file. The returned *:obj:str is owned by V_Sim and should not be freed or modified.
- Return type:
This methods is used to get the filename used for different config files.
- classmethod getStatic(kind)¶
- Parameters:
kind (
v_sim.ConfigFileKind) – a kind of configuration file.- Returns:
a
v_sim.ConfigFileobject, owned by V_Sim.- Return type:
Retrieve the instance used by V_Sim to read resource or parameter files.
New in version 3.8.
- classmethod loadCommandLine()¶
- Raises:
- Returns:
Trueon success.- Return type:
For every command line option (e.g. -o axes_line_width=3), call the corresponding ressource callback.
New in version 3.8.
- classmethod saveResourcesToXML(filename, dataObj)¶
- Parameters:
filename (
str) – the path to file to read ;dataObj (
v_sim.DataorNone) – av_sim.Dataobject (can beNone) ;
- Raises:
- Returns:
Trueif everything goes right.- lines:
a pointer to an integer (can be
None) ;
- Return type:
Same routine as
v_sim.ConfigFile.save() but use an XML format instead.New in version 3.7.
- addBooleanArrayEntry(key, description, nValues, location, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will be several booleans to read and to store in location. If labelled isTrue, it retrieves and store a string before the boolean value. It can be accessed later withv_sim.ConfigFileEntry.getLabel().New in version 3.8.
- addBooleanEntry(key, description, location, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will be a single boolean to read and to store in location. If labelled isTrue, it retrieves and store a string before the boolean value. It can be accessed later withv_sim.ConfigFileEntry.getLabel().New in version 3.7.
- addEntry(key, description, nbLines, readFunc)¶
- Parameters:
nbLines (
int) – an integer ;readFunc (
v_sim.ConfigFileReadFunc) – av_sim.ConfigFileReadFunc.
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
This creates a new
v_sim.ConfigFileEntryobject with the given values. The key and description arguments are copied.
- addEnumEntry(key, description, location, toEnum, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will parse a string and convert it to an enum value with toEnum function and store it in location.New in version 3.8.
- addExportFunction(writeFunc)¶
- Parameters:
writeFunc (
v_sim.ConfigFileExportFunc) – av_sim.ConfigFileExportFuncmethod.
This stores the writeFunc given. It will be called when resources or parameters will be exported to disk.
- addFloatArrayEntry(key, description, nValues, location, clamp, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will parse nValues floats and store them consecutively in location. The parsed values are checked to be in clamp.New in version 3.7.
- addIntegerArrayEntry(key, description, nValues, location, clamp, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will parse nValues usable for stipple and store them consecutively in location.New in version 3.8.
- addStippleArrayEntry(key, description, nValues, location)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will parse nValues usable for stipple and store them consecutively in location.New in version 3.8.
- addStringEntry(key, description, location)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a
v_sim.ConfigFileEntrythat will be a string to read and to store in location. If location already contains a string, it isGLib.free().New in version 3.7.
- addTokenizedEntry(key, description, labelled)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Defines a new
v_sim.ConfigFileEntryobject characterized by key. When key is found in a configuration file, the data line is separated into tokens that can be retrieved later withv_sim.ConfigFileEntry.popToken() for instance. If labelled isTrue, the associated label to an entry in the file can be later retrieved withv_sim.ConfigFileEntry.getLabel().New in version 3.8.
- exportToXML(filename)¶
- Parameters:
filename (
str) – a string in the encoding of the file system ;- Raises:
- Returns:
Trueif the file is written with success.- Return type:
Export all the registered entries for resources or parameters to an XML file.
- getEntries()¶
-
This routine should be used for introspections purpose, to know what resources or parameters are available.
- getNextValidPath(accessMode, list, utf8)¶
- Parameters:
- Returns:
the first valid path find in the given list of paths.
- list:
a pointer to a valid *:obj:GLib.List ;
- Return type:
Test the entries of the given list to find a valid position to read or write a config file. It tests access for the specified file. After a call to this method the list argument points to the next entry in the list, after the one found.
- getPath()¶
- Returns:
the path used to read the last resource file.
- Return type:
The resource file can be read from different places.
New in version 3.6.
- getPathList()¶
- Returns:
the list of the parameters or resources paths. This list is read-only.
- Return type:
[
str]
V_Sim stores a list of paths where to look for resources or parameters files, this method is used to get these lists.
- getValidPath(mode, utf8)¶
- Parameters:
- Returns:
the first valid path find in the list of known paths.
- Return type:
Test the entries of the hadoc list to find a valid position to read or write a config file. It tests access for the specified file.
- ignoreEntry(key, nbLines)¶
- Parameters:
- Returns:
the newly created
v_sim.ConfigFileEntryobject.- Return type:
Create a
v_sim.ConfigFileEntrythat will ignore key when found in a configuration file. This is used for deprecated keys.New in version 3.8.
- load(filename)¶
- Parameters:
filename (
str) – the path to file to read ;- Raises:
- Returns:
Trueif everything goes right. If error is notNoneit should be freed withGLib.Error.free().- Return type:
Try to load the resources/parameters from the file name given in parameter.
- save(fileName, lines, dataObj)¶
- Parameters:
fileName (
str) – the path to file to read ;dataObj (
v_sim.DataorNone) – av_sim.Dataobject (can beNone) ;
- Raises:
- Returns:
Trueif everything goes right.- Return type:
Try to export the resources/parameters to the file name given in parameter. If lines argument is not
None, and everything went right, it stores the number of written lines. If the argument dataObj is not null, only resources related to thev_sim.Dataobject should be exported (for parameters files, dataObj is alwaysNone).
Signal Details¶
- v_sim.ConfigFile.signals.parsed(config_file, key)¶
- Signal Name:
parsed- Flags:
- Parameters:
config_file (
v_sim.ConfigFile) – The object which received the signalkey (
v_sim.ConfigFileEntry) – the key that has been parsed.
The entry key of a configuration file has just been successfully parsed.
New in version 3.7.