PyDMTemplateRepeater¶
-
class
pydm.widgets.template_repeater.
PyDMTemplateRepeater
(parent=None)[source]¶ PyDMTemplateRepeater takes a .ui file with macro variables as a template, and a JSON file (or a list of dictionaries) with a list of values to use to fill in the macro variables, then creates a layout with one instance of the template for each item in the list.
It can be very convenient if you have displays that repeat the same set of widgets over and over - for instance, if you have a standard set of controls for a magnet, and want to build a display with a list of controls for every magnet, the Template Repeater lets you do that with a minimum amount of work: just build a template for a single magnet, and a JSON list with the data that describes all of the magnets.
- Parameters
parent (optional) – The parent of this widget.
-
countShownInDesigner
¶ The number of instances to show in Qt Designer. This property has no effect outside of Designer.
- Returns
- Return type
int
-
property
data
¶ The dictionary used by the widget to fill in each instance of the template. This property will be overwritten if the user changes the dataSource property.
-
dataSource
¶ The path to the JSON file to fill in each instance of the template.
- Returns
- Return type
str
-
layoutType
¶ The layout type to use.
- Returns
- Return type
LayoutType
-
open_template_file
(variables=None)[source]¶ Opens the widget specified in the templateFilename property.
- Parameters
variables (dict) – A dictionary of macro variables to apply when loading, in addition to all the macros specified on the template repeater widget.
- Returns
display
- Return type
QWidget
-
rebuild
()[source]¶ Clear out all existing widgets, and populate the list using the template file and data source.
-
templateFilename
¶ The path to the .ui file to use as a template.
- Returns
- Return type
str