.configuration - Data structure for saving PyBERT configuration.
Simulation configuration data encapsulation, for PyBERT.
Original Author: David Banas <capn.freako@gmail.com>
Original Date: 5 May 2017
This Python script provides a data structure for encapsulating the simulation configuration data of a PyBERT instance. It was first created, as a way to facilitate easier pickling, so that a particular configuration could be saved and later restored.
Copyright (c) 2017 by David Banas; All rights reserved World wide.
- exception pybert.configuration.InvalidFileType[source]
Bases:
ExceptionRaised when a filetype that isn’t supported is used when trying to load or save files..
- class pybert.configuration.PyBertCfg(the_PyBERT, date_created: str, version: str)[source]
Bases:
objectPyBERT simulation configuration data encapsulation class.
This class is used to encapsulate that subset of the configuration data for a PyBERT instance, which is to be saved when the user clicks the “Save Config.” button.
Copy just that subset of the supplied PyBERT instance’s __dict__, which should be saved.
- static load_from_file(filepath: str | Path, pybert)[source]
Apply all of the configuration settings to the pybert instance.
Confirms that the file actually exists, is the correct extension and attempts to set the values back in pybert.
- Parameters:
filepath – The full filepath including the extension to save too.
pybert – instance of the main app
- save(filepath: str | Path)[source]
Save out pybert’s current configuration to a file.
The extension must match a yaml file extension or it will still raise an invalid file type. Additional filetypes can be added/supported by just adding another if statement and adding to CONFIG_FILEDIALOG_WILDCARD.
- Parameters:
filepath – The full filepath including the extension to save too.
- pybert.configuration.CONFIG_LOAD_WILDCARD = 'Yaml Config (*.yaml;*.yml)|*.yaml;*.yml|Pickle Config (*.pybert_cfg)|*.pybert_cfg|All files (*)|*'
This sets the supported file types in the GUI’s loading dialog.
- pybert.configuration.CONFIG_SAVE_WILDCARD = 'Yaml Config (*.yaml;*.yml)|*.yaml;*.yml|All files (*)|*'
This sets the supported file types in the GUI’s save-as dialog.