diff --git a/schemas/pvi.device.schema.json b/schemas/pvi.device.schema.json
index d13d33de..92f09ac5 100644
--- a/schemas/pvi.device.schema.json
+++ b/schemas/pvi.device.schema.json
@@ -196,8 +196,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"pv": {
"description": "Child device PVI PV",
"title": "Pv",
@@ -278,8 +292,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"layout": {
"description": "How to layout children on screen",
"oneOf": [
@@ -467,8 +495,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"read_pv": {
"description": "PV to use for readback",
"title": "Read Pv",
@@ -539,8 +581,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"write_pv": {
"description": "PV to use for demand",
"title": "Write Pv",
@@ -644,8 +700,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"type": {
"const": "SignalRef",
"default": "SignalRef",
@@ -682,8 +752,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"write_pv": {
"description": "PV to use for demand",
"title": "Write Pv",
@@ -753,8 +837,22 @@
}
],
"default": null,
+ "description": "Label for component",
"title": "Label"
},
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Description for label tooltip",
+ "title": "Description"
+ },
"write_pv": {
"description": "PV to use for demand",
"title": "Write Pv",
diff --git a/src/pvi/_format/dls.bob b/src/pvi/_format/dls.bob
index 5f014f92..9b4fd67d 100644
--- a/src/pvi/_format/dls.bob
+++ b/src/pvi/_format/dls.bob
@@ -41,6 +41,7 @@
58
120
30
+ $(text)
TextEntry
diff --git a/src/pvi/_format/dls.py b/src/pvi/_format/dls.py
index b396a4ac..bf7f0928 100644
--- a/src/pvi/_format/dls.py
+++ b/src/pvi/_format/dls.py
@@ -240,7 +240,7 @@ def format_bob(self, device: Device, path: Path):
label_formatter_cls=LabelWidgetFormatter.from_template(
template,
search="Label",
- property_map={"text": "text"},
+ property_map={"text": "text", "tooltip": "description"},
),
led_formatter_cls=PVWidgetFormatter.from_template(
template,
diff --git a/src/pvi/_format/screen.py b/src/pvi/_format/screen.py
index 3f3a3091..3f7ddb21 100644
--- a/src/pvi/_format/screen.py
+++ b/src/pvi/_format/screen.py
@@ -475,7 +475,7 @@ def generate_component_formatters(
self.layout.label_width, self.layout.spacing
)
yield self.widget_formatter_factory.label_formatter_cls(
- bounds=left, text=c.get_label()
+ bounds=left, text=c.get_label(), description=c.description or ""
)
else:
# Allow full width for widget
diff --git a/src/pvi/_format/widget.py b/src/pvi/_format/widget.py
index 3a507a79..20c7b189 100644
--- a/src/pvi/_format/widget.py
+++ b/src/pvi/_format/widget.py
@@ -141,6 +141,7 @@ def format(self: WidgetFormatter[T]) -> List[T]:
class LabelWidgetFormatter(WidgetFormatter[T]):
text: str
+ description: str = ""
class PVWidgetFormatter(WidgetFormatter[T]):
diff --git a/src/pvi/device.py b/src/pvi/device.py
index e7e09d11..cc91496a 100644
--- a/src/pvi/device.py
+++ b/src/pvi/device.py
@@ -291,7 +291,10 @@ class Named(TypedModel):
class Component(Named):
"""These make up a Device"""
- label: Optional[str] = None
+ label: Annotated[str | None, Field(description="Label for component")] = None
+ description: Annotated[
+ str | None, Field(description="Description for label tooltip")
+ ] = None
def get_label(self):
return self.label or to_title_case(self.name)
diff --git a/tests/format/input/signal_default_widgets.pvi.device.yaml b/tests/format/input/signal_default_widgets.pvi.device.yaml
index 5d6cc223..232b84a3 100644
--- a/tests/format/input/signal_default_widgets.pvi.device.yaml
+++ b/tests/format/input/signal_default_widgets.pvi.device.yaml
@@ -5,6 +5,7 @@ children:
- type: SignalR
name: Read
+ description: A read-only signal
read_pv: Read
- type: SignalW
diff --git a/tests/format/output/button.bob b/tests/format/output/button.bob
index a3421c2c..3b932792 100644
--- a/tests/format/output/button.bob
+++ b/tests/format/output/button.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
TextEntry
@@ -62,6 +63,7 @@
54
120
20
+ $(text)
WritePV
@@ -104,6 +106,7 @@
78
120
20
+ $(text)
WritePV
diff --git a/tests/format/output/combo_box.bob b/tests/format/output/combo_box.bob
index 17b622bc..e8aed6dc 100644
--- a/tests/format/output/combo_box.bob
+++ b/tests/format/output/combo_box.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
ComboBox
diff --git a/tests/format/output/device_ref.bob b/tests/format/output/device_ref.bob
index 01c46d03..1f3db3ee 100644
--- a/tests/format/output/device_ref.bob
+++ b/tests/format/output/device_ref.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
OpenDisplay
diff --git a/tests/format/output/index.bob b/tests/format/output/index.bob
index 540577e4..ba53ed6c 100644
--- a/tests/format/output/index.bob
+++ b/tests/format/output/index.bob
@@ -32,6 +32,7 @@
30
150
20
+ $(text)
OpenDisplay
@@ -59,6 +60,7 @@
55
150
20
+ $(text)
OpenDisplay
@@ -86,6 +88,7 @@
80
150
20
+ $(text)
OpenDisplay
diff --git a/tests/format/output/mixedWidgets.bob b/tests/format/output/mixedWidgets.bob
index 0885a74c..8b36f400 100644
--- a/tests/format/output/mixedWidgets.bob
+++ b/tests/format/output/mixedWidgets.bob
@@ -39,6 +39,7 @@
0
120
20
+ $(text)
ToggleButton
@@ -55,6 +56,7 @@
24
120
20
+ $(text)
ToggleButton
@@ -71,6 +73,7 @@
48
120
20
+ $(text)
TextEntry
@@ -88,6 +91,7 @@
72
120
20
+ $(text)
TextEntry
@@ -105,6 +109,7 @@
96
120
20
+ $(text)
TextEntry
@@ -122,6 +127,7 @@
120
120
20
+ $(text)
TextEntry
@@ -139,6 +145,7 @@
144
120
20
+ $(text)
TextEntry
@@ -156,6 +163,7 @@
168
120
20
+ $(text)
TextEntry
@@ -173,6 +181,7 @@
192
120
20
+ $(text)
TextEntry
@@ -190,6 +199,7 @@
216
120
20
+ $(text)
TextEntry
@@ -207,6 +217,7 @@
240
120
20
+ $(text)
TextEntry
@@ -225,6 +236,7 @@
328
120
20
+ $(text)
TextEntry
@@ -242,6 +254,7 @@
352
120
20
+ $(text)
TextEntry
@@ -259,6 +272,7 @@
376
120
20
+ $(text)
TextEntry
@@ -276,6 +290,7 @@
400
120
20
+ $(text)
TextEntry
@@ -293,6 +308,7 @@
424
120
20
+ $(text)
TextEntry
@@ -310,6 +326,7 @@
448
120
20
+ $(text)
TextEntry
@@ -327,6 +344,7 @@
472
120
20
+ $(text)
TextEntry
@@ -344,6 +362,7 @@
496
120
20
+ $(text)
TextEntry
@@ -361,6 +380,7 @@
520
120
20
+ $(text)
TextEntry
@@ -378,6 +398,7 @@
544
120
20
+ $(text)
TextEntry
@@ -395,6 +416,7 @@
568
120
20
+ $(text)
TextEntry
@@ -412,6 +434,7 @@
592
120
20
+ $(text)
TextEntry
@@ -429,6 +452,7 @@
616
120
20
+ $(text)
TextEntry
@@ -446,6 +470,7 @@
640
120
20
+ $(text)
TextEntry
@@ -463,6 +488,7 @@
664
120
20
+ $(text)
TextEntry
@@ -487,6 +513,7 @@
0
120
20
+ $(text)
TextEntry
@@ -504,6 +531,7 @@
24
120
20
+ $(text)
TextEntry
@@ -521,6 +549,7 @@
48
120
20
+ $(text)
TextEntry
@@ -538,6 +567,7 @@
72
120
20
+ $(text)
TextEntry
@@ -555,6 +585,7 @@
96
120
20
+ $(text)
LED
@@ -571,6 +602,7 @@
120
120
20
+ $(text)
TextUpdate
@@ -592,6 +624,7 @@
144
120
20
+ $(text)
LED
@@ -608,6 +641,7 @@
168
120
20
+ $(text)
TextUpdate
@@ -629,6 +663,7 @@
192
120
20
+ $(text)
TextUpdate
@@ -651,6 +686,7 @@
280
120
20
+ $(text)
TextUpdate
@@ -672,6 +708,7 @@
304
120
20
+ $(text)
TextUpdate
@@ -693,6 +730,7 @@
328
120
20
+ $(text)
TextUpdate
@@ -714,6 +752,7 @@
352
120
20
+ $(text)
TextUpdate
@@ -735,6 +774,7 @@
376
120
20
+ $(text)
TextUpdate
@@ -756,6 +796,7 @@
400
120
20
+ $(text)
TextUpdate
@@ -777,6 +818,7 @@
424
120
20
+ $(text)
TextEntry
@@ -807,6 +849,7 @@
448
120
20
+ $(text)
TextEntry
@@ -844,6 +887,7 @@
0
120
20
+ $(text)
TextEntry
@@ -874,6 +918,7 @@
24
120
20
+ $(text)
ToggleButton
@@ -898,6 +943,7 @@
48
120
20
+ $(text)
TextEntry
@@ -928,6 +974,7 @@
72
120
20
+ $(text)
TextEntry
@@ -958,6 +1005,7 @@
96
120
20
+ $(text)
ComboBox
@@ -987,6 +1035,7 @@
120
120
20
+ $(text)
ComboBox
@@ -1003,6 +1052,7 @@
144
120
20
+ $(text)
ProgressBar
@@ -1019,6 +1069,7 @@
168
120
20
+ $(text)
BitField
@@ -1035,6 +1086,7 @@
192
120
20
+ $(text)
ArrayTrace
@@ -1069,6 +1121,7 @@
216
120
20
+ $(text)
ImageRead
diff --git a/tests/format/output/signal_default_widgets.bob b/tests/format/output/signal_default_widgets.bob
index c4b52806..0173f78c 100644
--- a/tests/format/output/signal_default_widgets.bob
+++ b/tests/format/output/signal_default_widgets.bob
@@ -32,6 +32,7 @@
30
120
20
+ A read-only signal
TextUpdate
@@ -53,6 +54,7 @@
54
120
20
+ $(text)
TextEntry
@@ -70,6 +72,7 @@
78
120
20
+ $(text)
TextEntry
@@ -87,6 +90,7 @@
102
120
20
+ $(text)
TextEntry
@@ -117,6 +121,7 @@
126
120
20
+ $(text)
WritePV
diff --git a/tests/format/output/static_table.bob b/tests/format/output/static_table.bob
index 330c872a..453f35f8 100644
--- a/tests/format/output/static_table.bob
+++ b/tests/format/output/static_table.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
LED
diff --git a/tests/format/output/static_table_BigTable.bob b/tests/format/output/static_table_BigTable.bob
index 7d95c896..c561ab0f 100644
--- a/tests/format/output/static_table_BigTable.bob
+++ b/tests/format/output/static_table_BigTable.bob
@@ -120,6 +120,7 @@
54
120
20
+ $(text)
LED
@@ -175,6 +176,7 @@
78
120
20
+ $(text)
LED
@@ -230,6 +232,7 @@
102
120
20
+ $(text)
LED
@@ -285,6 +288,7 @@
126
120
20
+ $(text)
LED
diff --git a/tests/format/output/sub_screen.bob b/tests/format/output/sub_screen.bob
index d5923736..58a62311 100644
--- a/tests/format/output/sub_screen.bob
+++ b/tests/format/output/sub_screen.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
TextUpdate
@@ -76,6 +77,7 @@
0
120
20
+ $(text)
TextUpdate
@@ -97,6 +99,7 @@
24
120
20
+ $(text)
OpenDisplay
diff --git a/tests/format/output/sub_screen_Group1.bob b/tests/format/output/sub_screen_Group1.bob
index 85fbb588..262b18ba 100644
--- a/tests/format/output/sub_screen_Group1.bob
+++ b/tests/format/output/sub_screen_Group1.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
TextUpdate
@@ -60,6 +61,7 @@
0
120
20
+ $(text)
TextUpdate
@@ -81,6 +83,7 @@
24
120
20
+ $(text)
TextUpdate
diff --git a/tests/format/output/sub_screen_Group4.bob b/tests/format/output/sub_screen_Group4.bob
index 9a470a20..8369d759 100644
--- a/tests/format/output/sub_screen_Group4.bob
+++ b/tests/format/output/sub_screen_Group4.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
TextUpdate
@@ -60,6 +61,7 @@
0
120
20
+ $(text)
TextUpdate
@@ -81,6 +83,7 @@
24
120
20
+ $(text)
TextUpdate
diff --git a/tests/format/output/text_format.bob b/tests/format/output/text_format.bob
index 46a18cc0..c9ee0b6f 100644
--- a/tests/format/output/text_format.bob
+++ b/tests/format/output/text_format.bob
@@ -32,6 +32,7 @@
30
120
20
+ $(text)
TextEntry
@@ -64,6 +65,7 @@
54
120
20
+ $(text)
TextEntry
@@ -96,6 +98,7 @@
78
120
20
+ $(text)
TextEntry
@@ -128,6 +131,7 @@
102
120
20
+ $(text)
TextEntry
@@ -160,6 +164,7 @@
126
120
20
+ $(text)
TextEntry