Exemple #1
0
    def run(self):
        temp_cvs = Module.temperature_canvas(self.unit, self.zip_code,
                                             self.temp_color)

        tme = int(time.time())

        while not self.should_stop:
            if int(time.time()) - tme == self.ref_rate:
                temp_cvs = Module.temperature_canvas(self.unit, self.zip_code,
                                                     self.temp_color)
                tme = int(time.time())

            time_cvs = Canvas(25, 19).add_subcanvas(
                Module.time_canvas(self.region, self.day_color,
                                   self.date_color, self.hour_color,
                                   self.hour_color, self.minute_color),
                Point(0, 6))

            time_cvs.add_subcanvas(temp_cvs, Point(9, 0))

            matrix.draw_canvas(Canvas().add_subcanvas(time_cvs, Point(3, 6)))
Exemple #2
0
def draw_dashboard(ref_rate=3):  # includes clock and temperature
    """ ref_rate is the interval (in minutes) between weather API calls """
    temp_cvs = Module.temperature_canvas('f', '94103', Color.green())

    ref_rate = ref_rate * 60

    tme = int(time.time())

    matrix = EzMatrix()

    while True:
        if int(time.time()) - tme == ref_rate:
            temp_cvs = Module.temperature_canvas('f', '94103', Color.green())
            tme = int(time.time())

        time_cvs = Canvas(25,
                          19).add_subcanvas(Module.time_canvas('US/Pacific'),
                                            Point(0, 6))

        time_cvs.add_subcanvas(temp_cvs, Point(9, 0))

        matrix.draw_canvas(Canvas().add_subcanvas(time_cvs, Point(3, 6)))