fosKeyMan
Loading...
Searching...
No Matches
src.frontend.configmanager.ConfigManager Class Reference

Manage the loading, saving, and validation of configuration settings for directories. More...

Inheritance diagram for src.frontend.configmanager.ConfigManager:

Public Member Functions

 __init__ (self, config_path)
 Initialize the ConfigManager with the path to the configuration file.
 
 check_and_load_previous_config (self)
 Load and check if previously saved directories are valid.
 
 confirm_directory_selection (self, dialog, open_ui)
 Confirm the directory selection made by the user.
 
 create_default_config (self)
 Create a default configuration file.
 
 load_config (self)
 Load the configuration file.
 
 save_config (self)
 Save the current directory paths to the configuration file.
 
 select_directory1 (self, dialog, open_ui)
 Open a file dialog for the user to select the first (activated keyfile) directory.
 
 select_directory2 (self, dialog, open_ui)
 Open a file dialog for the user to select the second (deactivated keyfile) directory.
 
 select_directory3 (self, dialog, open_ui)
 Open a file dialog for the user to select the trash directory.
 

Public Attributes

 config = self.load_config()
 
 config_path = config_path
 
list custom_columns = None
 
 directory1 = None
 
 directory2 = None
 
 directory3 = None
 
str language = None
 

Static Public Attributes

list DEFAULT_COLUMNS = ["Project", "Operator", "Specimen", "DFOS_Type", "Installation", "Note"]
 

Detailed Description

Manage the loading, saving, and validation of configuration settings for directories.

Language setting for the user interface (e.g., 'english' or 'german'). Handle user interaction for selecting directories, and ensures that the configuration is correctly loaded from and saved to a JSON file.

Definition at line 7 of file configmanager.py.

Constructor & Destructor Documentation

◆ __init__()

src.frontend.configmanager.ConfigManager.__init__ ( self,
config_path )

Initialize the ConfigManager with the path to the configuration file.

Parameters
config_path(str): The file path where the configuration is stored.

Definition at line 16 of file configmanager.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ check_and_load_previous_config()

src.frontend.configmanager.ConfigManager.check_and_load_previous_config ( self)

Load and check if previously saved directories are valid.

Returns
(tuple): directory1, directory2, language

Definition at line 77 of file configmanager.py.

◆ confirm_directory_selection()

src.frontend.configmanager.ConfigManager.confirm_directory_selection ( self,
dialog,
open_ui )

Confirm the directory selection made by the user.

Validate that both directories exist, and close the dialog if valid.

Parameters
dialog(QDialog): The dialog window that allows the user to select directories.
open_ui(QWidget): The UI that contains the directory input fields.

Definition at line 146 of file configmanager.py.

◆ create_default_config()

src.frontend.configmanager.ConfigManager.create_default_config ( self)

Create a default configuration file.

Default language is English.

Returns
(dict): The default configuration.

Definition at line 31 of file configmanager.py.

Here is the caller graph for this function:

◆ load_config()

src.frontend.configmanager.ConfigManager.load_config ( self)

Load the configuration file.

If it doesn't exist or has errors, return an empty configuration.

Returns
(dict): The loaded configuration as a dictionary, or the default dictionary if the file contains errors.

Definition at line 48 of file configmanager.py.

Here is the call graph for this function:

◆ save_config()

src.frontend.configmanager.ConfigManager.save_config ( self)

Save the current directory paths to the configuration file.

Definition at line 63 of file configmanager.py.

◆ select_directory1()

src.frontend.configmanager.ConfigManager.select_directory1 ( self,
dialog,
open_ui )

Open a file dialog for the user to select the first (activated keyfile) directory.

Parameters
dialog(QDialog): The dialog window that allows the user to select directories.
open_ui(QWidget): The UI that contains the directory input fields.

Definition at line 110 of file configmanager.py.

◆ select_directory2()

src.frontend.configmanager.ConfigManager.select_directory2 ( self,
dialog,
open_ui )

Open a file dialog for the user to select the second (deactivated keyfile) directory.

Parameters
dialog(QDialog): The dialog window that allows the user to select directories.
open_ui(QWidget): The UI that contains the directory input fields.

Definition at line 122 of file configmanager.py.

◆ select_directory3()

src.frontend.configmanager.ConfigManager.select_directory3 ( self,
dialog,
open_ui )

Open a file dialog for the user to select the trash directory.

Parameters
dialog(QDialog): The dialog window that allows the user to select directories.
open_ui(QWidget): The UI that contains the directory input fields.

Definition at line 134 of file configmanager.py.

Member Data Documentation

◆ config

src.frontend.configmanager.ConfigManager.config = self.load_config()

Definition at line 29 of file configmanager.py.

◆ config_path

src.frontend.configmanager.ConfigManager.config_path = config_path

Definition at line 23 of file configmanager.py.

◆ custom_columns

list src.frontend.configmanager.ConfigManager.custom_columns = None

Definition at line 28 of file configmanager.py.

◆ DEFAULT_COLUMNS

list src.frontend.configmanager.ConfigManager.DEFAULT_COLUMNS = ["Project", "Operator", "Specimen", "DFOS_Type", "Installation", "Note"]
static

Definition at line 14 of file configmanager.py.

◆ directory1

src.frontend.configmanager.ConfigManager.directory1 = None

Definition at line 24 of file configmanager.py.

◆ directory2

src.frontend.configmanager.ConfigManager.directory2 = None

Definition at line 25 of file configmanager.py.

◆ directory3

src.frontend.configmanager.ConfigManager.directory3 = None

Definition at line 26 of file configmanager.py.

◆ language

src.frontend.configmanager.ConfigManager.language = None

Definition at line 27 of file configmanager.py.


The documentation for this class was generated from the following file: