ViewSaver

ViewSaver widget — persists and restores widget states via QSettings.

../../../_images/view_saver.png
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_properties or is registered in registry.WIDGET_REGISTRY is tracked.

Optional excludedWidgets list 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.

classmethod get_designer_icon() → QIcon[source]

Icon for usage in Qt designer.

paintEvent(event: QPaintEvent) → None[source]

Draw a dashed outline and corner label, but only in Qt Designer.

At runtime nothing is painted so the container is fully transparent and only its child widgets are visible.

sizeHint() → QSize[source]

Default size when first dropped in Designer.