The widgets sub-package#
Package with modified widgets required for creating the pydidas graphical user interface.
- class pydidas.widgets.PydidasFileDialog(*args: Any, **kwargs: Any)#
Bases:
_PydidasFileDialog
- pydidas.widgets.delete_all_items_in_layout(layout: QLayout) None#
Recursively delete items in a QLayout.
- Parameters:
layout (QLayout) – The layout to be cleared.
- pydidas.widgets.get_max_pixel_width_of_entries(entries: str | tuple | list) int#
Get the maximum width from a number of entries.
This function calculates the width (in pixels) of a list of given strings.
- Parameters:
entries (str or tuple or list) – The entries.
- Returns:
The maximum width of the entries in pixels.
- Return type:
int
- pydidas.widgets.get_pyqt_icon_from_str(ref_string: str) QIcon#
Get a QIcon from the reference string.
- Four types of strings can be processed:
A reference number of a QStandardIcon, preceded by a ‘qt-std::’.
A reference to an image file in the file system. The filename must be preceded by ‘path::’.
A reference to an icon in pydidas.core.icons with the filename preceded by a ‘pydidas::’
A reference to a mdi icon with the filename preceded by a ‘mdi::’ Note that this only works for those mdi icons which have been included in pydidas.
- Parameters:
ref_string (str) – The reference string for the icon.
- Raises:
TypeError – If no correct preceding type has been found.
- Returns:
The icon
- Return type:
QtGui.QIcon
- pydidas.widgets.get_widget_layout_args(parent: QWidget, **kwargs: Any) list#
Get the arguments for adding a widget to the layout of the parent.
- Parameters:
parent (QWidget) – The parent QWidget to which the new widget shall be added.
**kwargs (Any) – Keyword arguments. This method only takes the “gridPos”, “stretch” and “alignment” arguments from the kwargs.
- Raises:
PydidasGuiError – If the parent widget has no supported layout. Supported are QBoxLayout, QStackedLayout or QGridLayout and subclasses.
- Returns:
The list of layout arguments required for adding the widget to the layout of the parent widget.
- Return type:
list
- pydidas.widgets.icon_with_inverted_colors(icon: QIcon) QIcon#
Invert the colors of a QIcon.
- Parameters:
icon (QIcon) – The icon to be inverted.
- Returns:
The inverted icon.
- Return type:
QIcon