updates NumberSlider (constructor kwargs)

This commit is contained in:
Mose Müller 2023-11-28 14:41:28 +01:00
parent 9e9d3f17bc
commit c04e048e21

View File

@ -13,15 +13,15 @@ class NumberSlider(DataService):
Parameters: Parameters:
----------- -----------
value (float | int, optional): value (float, optional):
The initial value of the slider. Defaults to 0. The initial value of the slider. Defaults to 0.
min (float, optional): min (float, optional):
The minimum value of the slider. Defaults to 0. The minimum value of the slider. Defaults to 0.
max (float, optional): max (float, optional):
The maximum value of the slider. Defaults to 100. The maximum value of the slider. Defaults to 100.
step_size (float | int, optional): step_size (float, optional):
The increment/decrement step size of the slider. Defaults to 1.0. The increment/decrement step size of the slider. Defaults to 1.0.
type (Literal["int"] | Literal["float"], optional): type (Literal["int", "float"], optional):
The type of the slider value. Determines if the value is an integer or float. The type of the slider value. Determines if the value is an integer or float.
Defaults to "float". Defaults to "float".
@ -38,23 +38,23 @@ class NumberSlider(DataService):
``` ```
""" """
def __init__( def __init__( # noqa: PLR0913
self, self,
value: float | int = 0, value: float = 0,
min: float = 0.0, min_: float = 0.0,
max: float = 100.0, max_: float = 100.0,
step_size: float | int = 1.0, step_size: float = 1.0,
type: Literal["int", "float"] = "float", type_: Literal["int", "float"] = "float",
) -> None: ) -> None:
if type not in {"float", "int"}: if type_ not in {"float", "int"}:
logger.error("Unknown type '%s'. Using 'float'.", type) logger.error("Unknown type '%s'. Using 'float'.", type_)
type = "float" type_ = "float"
self._type = type self._type = type_
self.step_size = step_size self.step_size = step_size
self.value = value self.value = value
self.min = min self.min = min_
self.max = max self.max = max_
super().__init__() super().__init__()