From e585fc0fe2703de01f0e20326fb2b30b487476cc Mon Sep 17 00:00:00 2001 From: Gary Yendell Date: Thu, 28 Mar 2024 11:57:53 +0000 Subject: [PATCH] Use human-readable strings for TextFormat enum values --- schemas/pvi.device.schema.json | 12 ++++++------ src/pvi/device.py | 10 +++++----- tests/convert/output/simDetector.pvi.device.yaml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/schemas/pvi.device.schema.json b/schemas/pvi.device.schema.json index 92f09ac5..a73a0b30 100644 --- a/schemas/pvi.device.schema.json +++ b/schemas/pvi.device.schema.json @@ -993,14 +993,14 @@ "TextFormat": { "description": "Format to use for display of Text{Read,Write} widgets on a UI", "enum": [ - 0, - 1, - 2, - 3, - 4 + "decimal", + "hexadecimal", + "engineer", + "exponential", + "string" ], "title": "TextFormat", - "type": "integer" + "type": "string" }, "TextRead": { "additionalProperties": false, diff --git a/src/pvi/device.py b/src/pvi/device.py index cc91496a..47a994ff 100644 --- a/src/pvi/device.py +++ b/src/pvi/device.py @@ -81,11 +81,11 @@ def enforce_pascal_case(s: str) -> str: class TextFormat(Enum): """Format to use for display of Text{Read,Write} widgets on a UI""" - decimal = 0 - hexadecimal = 1 - engineer = 2 - exponential = 3 - string = 4 + decimal = "decimal" + hexadecimal = "hexadecimal" + engineer = "engineer" + exponential = "exponential" + string = "string" class AccessModeMixin(BaseModel): diff --git a/tests/convert/output/simDetector.pvi.device.yaml b/tests/convert/output/simDetector.pvi.device.yaml index 7b4b775c..9a752ece 100644 --- a/tests/convert/output/simDetector.pvi.device.yaml +++ b/tests/convert/output/simDetector.pvi.device.yaml @@ -26,7 +26,7 @@ children: read_pv: $(P)$(R)XMLErrorMsg_RBV read_widget: type: TextRead - format: 4 + format: string - type: SignalR name: Dimensions