mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 08:20:02 +02:00
fix: using Enum instead of StrEnum (>=3.11 only)
This commit is contained in:
parent
26a366842a
commit
a8b14180ad
@ -294,7 +294,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
#### `ColouredEnum`
|
#### `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.
|
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.
|
||||||
|
|
||||||
|
@ -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.
|
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:
|
colour codes. Supported colour formats include:
|
||||||
- Hexadecimal colours
|
- Hexadecimal colours
|
||||||
- Hexadecimal colours with transparency
|
- Hexadecimal colours with transparency
|
||||||
|
Loading…
x
Reference in New Issue
Block a user