class documentation

class Config:

Known subclasses: magneticalc.Project.Project

View In Hierarchy

Config class.
Method __init__ Initializes the configuration.
Method cleanup Perform clean-up.
Method get_bool Gets boolean value, convert from string.
Method get_float Gets float value, convert from string.
Method get_generic Gets some "_key"-"_value" of data type "_type".
Method get_int Gets integer value, convert from string.
Method get_point Gets a single 3D point, convert from string.
Method get_points Gets list of 3D points, convert from string.
Method get_str Reads a configuration value.
Method load Loads the default configuration.
Method load_file Loads the configuration from file.
Method on_changed Gets called when the configuration was loaded, saved or changed.
Method remove_key Removes a key from the configuration.
Method save_file Saves the configuration to file.
Method set_bool Sets boolean value, convert to string.
Method set_float Sets float value, convert to string.
Method set_generic Sets some "_key"-"_value" of data type "_type".
Method set_get_bool If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_get_dict If "values" is None, reads and returns all key-values in "types". Note: The actual keys saved in the configuration file are prefixed with "prefix", and suffixed with "suffix".
Method set_get_float If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_get_int If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_get_point If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_get_points If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_get_str If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method set_int Sets integer value, convert to string.
Method set_point Sets a single 3D point, convert to string.
Method set_points Sets list of 3D points, convert to string.
Method set_str Writes a configuration value.
Class Variable DebugAccess Undocumented
Instance Variable filename Undocumented
Instance Variable synced Undocumented
Instance Variable _parser Undocumented
def __init__(self):
Initializes the configuration.
def cleanup(self):
Perform clean-up.
def get_bool(self, key):
Gets boolean value, convert from string.
Parameters
key:strKey
Returns
boolValue
def get_float(self, key):
Gets float value, convert from string.
Parameters
key:strKey
Returns
floatValue
def get_generic(self, _key, _type):
Gets some "_key"-"_value" of data type "_type".
Parameters
_key:strKey
_type:strData type
Returns
Union[str, bool, int, float, np.ndarray, List[float], List[List[float]]]Data (type determined by "_type")
def get_int(self, key):
Gets integer value, convert from string.
Parameters
key:strKey
Returns
intValue
def get_point(self, key):
Gets a single 3D point, convert from string.
Parameters
key:strKey
Returns
List[float]Single 3D point
def get_points(self, key):
Gets list of 3D points, convert from string.
Parameters
key:strKey
Returns
List[List[float]]List of 3D points
def get_str(self, key):
Reads a configuration value.
Parameters
key:strKey
Returns
strValue
def load(self, default_config, signal_changed=True):
Loads the default configuration.
Parameters
default_config:DictDefault configuration
signal_changed:boolUndocumented
def load_file(self, filename, default_config):
Loads the configuration from file.
Parameters
filename:strFilename
default_config:DictDefault configuration
@abc.abstractmethod
def on_changed(self):
Gets called when the configuration was loaded, saved or changed.
def remove_key(self, key):
Removes a key from the configuration.
Parameters
key:strKey
def save_file(self, filename=None):
Saves the configuration to file.
Parameters
filename:Optional[str]Filename (optional)
def set_bool(self, key, value):
Sets boolean value, convert to string.
Parameters
key:strKey
value:boolValue
def set_float(self, key, value):
Sets float value, convert to string.
Parameters
key:strKey
value:floatValue
def set_generic(self, _key, _type, _value):
Sets some "_key"-"_value" of data type "_type".
Parameters
_key:strKey
_type:strData type
_value:Union[str, bool, int, float, np.ndarray, List[float], List[List[float]]]Data (type determined by "_type")
def set_get_bool(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:boolValue
Returns
boolUndocumented
def set_get_dict(self, prefix, suffix, types, values):

If "values" is None, reads and returns all key-values in "types". Note: The actual keys saved in the configuration file are prefixed with "prefix", and suffixed with "suffix".

If "values" is not None, writes and returns all key-values in "types". Note: In this case, "values" must have the same keys as "types".

Parameters
prefix:strPrefix
suffix:strSuffix
types:DictKey:Type (Dictionary)
values:Optional[Dict]Key:Value (Dictionary)
Returns
DictUndocumented
def set_get_float(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:floatValue
Returns
floatUndocumented
def set_get_int(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:intValue
Returns
intUndocumented
def set_get_point(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:Union[np.ndarray, List[float]]Value
Returns
Union[np.ndarray, List[float]]Undocumented
def set_get_points(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:Union[np.ndarray, List[List[float]]]Value
Returns
Union[np.ndarray, List[List[float]]]Undocumented
def set_get_str(self, key, value):
If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Parameters
key:strKey
value:strValue
Returns
strUndocumented
def set_int(self, key, value):
Sets integer value, convert to string.
Parameters
key:strKey
value:intValue
def set_point(self, key, value):
Sets a single 3D point, convert to string.
Parameters
key:strKey
value:Union[np.ndarray, List[float]]Single 3D point
def set_points(self, key, value):
Sets list of 3D points, convert to string.
Parameters
key:strKey
value:Union[np.ndarray, List[List[float]]]List of 3D points
def set_str(self, key, value):
Writes a configuration value.
Parameters
key:strKey
value:strValue
DebugAccess: bool =

Undocumented

filename =

Undocumented

synced: bool =

Undocumented

_parser =

Undocumented