from ui.qml_widget import Qml_Widget


class Qml_Led(Qml_Widget):
    def __init__(self, size, color=None):
        super().__init__()
        self.set("size", size)
        self.set_color(color)

    def set_color(self, color):
        self.color = color
        if self.color is None:
            self.set("led_on", False)
            self.set("led_color", color)
        else:
            self.set("led_on", True)
            self.set("led_color", color)
