2023-04-24 04:33:00 +02:00
|
|
|
from typing import Dict, Any
|
2023-04-16 01:43:37 +02:00
|
|
|
|
|
|
|
from pyhon.parameter.base import HonParameter
|
|
|
|
|
|
|
|
|
|
|
|
class HonParameterFixed(HonParameter):
|
2023-05-06 16:07:28 +02:00
|
|
|
def __init__(self, key: str, attributes: Dict[str, Any], group: str) -> None:
|
|
|
|
super().__init__(key, attributes, group)
|
2023-07-12 00:05:27 +02:00
|
|
|
self._value = None
|
|
|
|
self._set_attributes()
|
|
|
|
|
|
|
|
def _set_attributes(self):
|
|
|
|
super()._set_attributes()
|
|
|
|
self._value = self._attributes.get("fixedValue", None)
|
2023-04-16 01:43:37 +02:00
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
|
|
|
return f"{self.__class__} (<{self.key}> fixed)"
|
|
|
|
|
|
|
|
@property
|
|
|
|
def value(self) -> str | float:
|
|
|
|
return self._value if self._value is not None else "0"
|
|
|
|
|
|
|
|
@value.setter
|
2023-04-16 02:44:20 +02:00
|
|
|
def value(self, value: str | float) -> None:
|
|
|
|
# Fixed values seems being not so fixed as thought
|
|
|
|
self._value = value
|
2023-05-21 02:25:43 +02:00
|
|
|
self.check_trigger(value)
|