Reference
Garnet
Main Qt application
Home
Presenter for the Home tab
- class garnet.home.presenter.HomePresenter(view: HomeView, model: HomeModel)[source]
Home presenter
- Parameters:
PyQt widget for the home tab
- class garnet.home.view.HomeView(*args: Any, **kwargs: Any)[source]
Home widget
- Parameters:
QWidget (QWidget) – The main widget
- update_button_status(error_text: Dict[str, str] | None = None)[source]
Update the status of the save button based on the presence of invalid fields and error messages.
- Parameters:
error_text – Dictionary of error messages for specific fields.
The save button will be enabled only if there are no invalid fields and no error messages.
- update_plan_name()[source]
Update the plan name field.
If the plan name is empty, set the style to indicate an invalid field with a red border, add an error message to the status bar, and disable the save button. Otherwise, clear the style, remove the error message from the status bar, and enable the save button.
- update_wavelength()[source]
Update the wavelength field.
If the input cannot be converted to a float, set the style to indicate an invalid field with a red border, add an error message to the status bar, and disable the save button. Otherwise, clear the style, remove the error message from the status bar, and enable the save button.
Model for the Home tab
Base Qt Objects
BaseLineEdit
This module defines the BaseLineEdit class, a customized QLineEdit with setup and helper functions for QLineEdits used in Garnet.
- class garnet.helpers.ui_elements.base_lineedit.BaseLineEdit(*args: Any, **kwargs: Any)[source]
BaseLineEdit that inherits the QLineEdit.
This class includes setup and helper functions for QLineEdits used in Garnet.
- Parameters:
required (bool, optional) – Indicate whether the field is required. Defaults to False.
default_value (Any, optional) – Set the default value for the field. Defaults to None.
parent (Any, optional) – The parent object that holds the QLineEdit. Defaults to None.
args – Additional positional arguments that will be passed to the parent class constructor.
kwargs – Additional keyword arguments that will be passed to the parent class constructor.
BaseStatusBar
This module defines the BaseStatusBar class, a custom status bar for PyQt applications. The BaseStatusBar provides functionality for displaying error messages and additional information through QLabel widgets. It includes methods to update the status label with error messages and the CWE (Caution, Warnings or Error) label with relevant information.
- class garnet.helpers.ui_elements.base_statusbar.BaseStatusBar(*args: Any, **kwargs: Any)[source]
Custom status bar for displaying error messages and additional information.
- update_cwe_label(text: str) None[source]
Update the cwe_label with the provided text.
- Parameters:
text (str) – The text to be displayed in the Caution, Warning, Error label.
BaseTableWidget
This module defines the BaseTableWidget class, a customized QTableWidget with setup and helper functions for QTableWidgets used in Garnet.
- class garnet.helpers.ui_elements.base_tablewidget.BaseTableWidget(*args: tuple[Any], required: bool | None = False, **kwargs: dict[str, Any])[source]
BaseTableWidget that inherits the QTableWidget.
This class includes setup and helper functions for QTableWidgets used in Garnet.
- Parameters:
required (bool, optional) – Indicate whether the field is required. Defaults to False.
parent (Any, optional) – The parent object that holds the QTableWidget. Defaults to None.
args – Additional positional arguments that will be passed to the parent class constructor.
kwargs – Additional keyword arguments that will be passed to the parent class constructor.
BaseCheckBox
This module defines the BaseCheckBox class, a customized QCheckBox with setup and helper functions for QCheckBoxes used in Garnet.
- class garnet.helpers.ui_elements.base_checkbox.BaseCheckBox(*args: tuple[Any], required: bool | None = False, **kwargs: dict[str, Any])[source]
BaseCheckBox that inherits the QCheckBox.
This class includes setup and helper functions for QCheckBoxes used in Garnet.
- Parameters:
required (bool, optional) – Indicate whether the field is required. Defaults to False.
parent (Any, optional) – The parent object that holds the QCheckBox. Defaults to None.
args – Additional positional arguments that will be passed to the parent class constructor.
kwargs – Additional keyword arguments that will be passed to the parent class constructor.
BaseListWidget
This module defines the BaseListWidget class, a customized QListWidget with setup and helper functions for QListWidgets used in Garnet.
- class garnet.helpers.ui_elements.base_listwidget.BaseListWidget(*args: tuple[Any], required: bool | None = False, **kwargs: dict[str, Any])[source]
BaseListWidget that inherits the QListWidget.
This class includes setup and helper functions for QListWidgets used in Garnet.
- Parameters:
required (bool, optional) – Indicate whether the field is required. Defaults to False.
parent (Any, optional) – The parent object that holds the QListWidget. Defaults to None.
args – Additional positional arguments that will be passed to the parent class constructor.
kwargs – Additional keyword arguments that will be passed to the parent class constructor.
When creating a BaseListWidget, also pay attention to the selection mode. The selection mode will change the behavior of the list widget when selecting items. The selection mode can be set using the setSelectionMode method.
- param mode:
Selection mode to be set. 0: NoSelection 1: SingleSelection 2: MultiSelection 3: ExtendedSelection 4: ContiguousSelection
- type mode:
int
more info about the selection mode can be found in the Qt documentation