From a8b14180ad7070ff25815ef232106d5d3e102dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 11 Oct 2023 13:46:15 +0200 Subject: [PATCH] fix: using Enum instead of StrEnum (>=3.11 only) --- README.md | 2 +- src/pydase/components/coloured_enum.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 64c8888..4fab516 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ if __name__ == "__main__": #### `ColouredEnum` -This component provides a way to visually represent different states or categories in a data service using colour-coded options. It behaves similarly to a standard `StrEnum`, but the values encode colours in a format understood by CSS. The colours can be defined using various methods like Hexadecimal, RGB, HSL, and more. +This component provides a way to visually represent different states or categories in a data service using colour-coded options. It behaves similarly to a standard `Enum`, but the values encode colours in a format understood by CSS. The colours can be defined using various methods like Hexadecimal, RGB, HSL, and more. If the property associated with the `ColouredEnum` has a setter function, the keys of the enum will be rendered as a dropdown menu, allowing users to interact and select different options. Without a setter function, the selected key will simply be displayed as a coloured box with text inside, serving as a visual indicator. diff --git a/src/pydase/components/coloured_enum.py b/src/pydase/components/coloured_enum.py index e75b9bd..40648c4 100644 --- a/src/pydase/components/coloured_enum.py +++ b/src/pydase/components/coloured_enum.py @@ -1,11 +1,11 @@ -from enum import StrEnum +from enum import Enum -class ColouredEnum(StrEnum): +class ColouredEnum(Enum): """ Represents a UI element that can display colour-coded text based on its value. - This class extends the standard StrEnum but requires its values to be valid CSS + This class extends the standard Enum but requires its values to be valid CSS colour codes. Supported colour formats include: - Hexadecimal colours - Hexadecimal colours with transparency