Dynamical Widgets
Widgets that listen for dynamically added or removed settings.
New in ScopeFoundry 2.0
If a setting is added or removed dynamically (i.e., not at startup), the settings tree in the sidebar updates automatically by adding or removing a default widget. You can add this behavior to your custom view of a Measurement
or DataBrowserView
.
The following examples show how to create dynamic widgets from a settings container. The dynamic widget will include the “connected” setting and will dynamically add widgets for any setting matching the pattern *_position
.
Examples
Create a new widget from an existing settings container:
dyn_widget = self.settings.New_UI(include=("connected", "*_position"))
Make an existing
layout
dynamic:from ScopeFoundry.dynamical_widgets import add_to_layout add_to_layout(self.settings, include=("connected", "*_position"))
Supported layouts are:QtWidgets.QFormLayout
, QtWidgets.QHBoxLayout
, QtWidgets.QVBoxLayout
.