Esempio n. 1
0
    def relay_section_draw(self):
        x = 300
        y = 90
        r = 9
        text_x = 75
        list_relay = Relay.get_relay_object_list()
        for relay in list_relay:
            if relay.get_state() == 1:
                color = "green"
            else:
                color = "red"
            self.draw.text((210, text_x), relay.name, fill=(32, 32, 32), font=self.font)

            self.draw.ellipse((x - r, y - r, x + r, y + r), fill=color)
            y += 25
            text_x += 25
Esempio n. 2
0
    def get(self):
        from Module.Relay import Relay
        object_id = self.get_argument("id", "None")
        relay_action = self.get_argument("type", "None")

        if object_id not in "None":

            if relay_action in "off":
                Relay.set_force_on(object_id, Relay.FORCE_OFF)

            if relay_action in "on":
                Relay.set_force_on(object_id, Relay.FORCE_ON)

            self.redirect('/relay')

        relay_list = Relay.get_relay_object_list()
        self.render("relay.html", relay_list=relay_list)
Esempio n. 3
0
    def get(self):
        from Module.Relay import Relay
        object_id = self.get_argument("id", "None")
        relay_action = self.get_argument("type", "None")

        if object_id not in "None":

            if relay_action in "off":
                Relay.set_force_on(object_id, Relay.FORCE_OFF)

            if relay_action in "on":
                Relay.set_force_on(object_id, Relay.FORCE_ON)

            self.redirect('/relay')

        relay_list = Relay.get_relay_object_list()
        self.render("relay.html", relay_list=relay_list)
Esempio n. 4
0
    def relay_section_draw(self):
        x = 300
        y = 90
        r = 9
        text_x = 75
        list_relay = Relay.get_relay_object_list()
        for relay in list_relay:
            if relay.get_state() == 1:
                color = "green"
            else:
                color = "red"
            self.draw.text((210, text_x),
                           relay.name,
                           fill=(32, 32, 32),
                           font=self.font)

            self.draw.ellipse((x - r, y - r, x + r, y + r), fill=color)
            y += 25
            text_x += 25