ViewSaver
ViewSaver widget — persists and restores widget states via QSettings.
- class pcdswidgets.common.tools.view_saver.view_saver.ViewSaver(parent: QWidget | None = None, **kwargs: Any)[source]
An invisible container that auto-saves and restores the view-state of the widgets placed inside it, using QSettings.
Drop this widget onto a screen and place the widgets you want persisted inside it.
Any child that exposes a
get_view_saver_propertiesor is registered inregistry.WIDGET_REGISTRYis tracked.Optional
excludedWidgetslist can opt children out.In QtDesigner the container draws a dashed border and a small corner label so it can be located and edited (double-click, or the right-click task menu, opens the settings dialog). At runtime it is fully transparent with no border or margins, so only its child widgets are visible.
Designer properties
- dirNamestr
Directory where the settings .ini file is stored (default
~/.config/pcds_view_saves).- fileNamestr
Name of the .ini file (without extension). Supports PyDM
${MACRO}expansion and this is recommended in situations the same UI screen is used for different devices Auto-generated rand on first load- excludedWidgetslist[str]
objectNames of savable child widgets to skip.
- eventFilter(obj: QObject, event: QEvent) bool[source]
Save when the watched container window is closing.