bool_control--buttonbox (Center)
"""
DEFAULT_CSS = """
- RadioButton {
- min-width:16 !important;
- text-align:center !important;
+ .bool_control--light{
+ min-width:16;
+ text-align: center;
+ }
+ .-warning {
+ # background:$warning;
+ .bool_control--light{
+ .toggle--button {
+ color:$text-warning;
+ }
+ }
}
"""
+
COMPONENT_CLASSES = {
"bool_control--light",
"bool_control--true_button",
"bool_control--light_box",
"bool_control--buttons_box",
}
+ warning: reactive[bool] = reactive(False)
+ """Updates color from whatever it is to yellow"""
value: reactive[bool] = reactive(False)
"""Updates the control's value; turns on or off the light."""
label: reactive[str] = reactive("Status")
@on(Button.Pressed, "#false")
- def false_pressed(self, event: Button.Pressed):
+ def false_pressed(self, event: Button.Pressed, _debug=False):
+ if _debug:
+ self.value = False
self.post_message(self.SetFalse(self))
@on(Button.Pressed, "#true")
- def true_pressed(self, event: Button.Pressed):
+ def true_pressed(self, event: Button.Pressed, _debug=False):
+ if _debug:
+ self.value = True
self.post_message(self.SetTrue(self))
light.compact = value
true.compact = value
false.compact = value
+
+ def watch_warning(self, value: bool):
+ self.set_class(value, "-warning")
def get_true_button(self):
return typing.cast(Button, self.query_exactly_one("#true"))