Exemplo n.º 1
0
    def draw_final(self):
        # Get the Info
        period = self.scoreboard.periods.ordinal
        result = self.scoreboard.periods.clock
        score = '{}-{}'.format(self.scoreboard.away_team.goals, self.scoreboard.home_team.goals)
        date = convert_date_format(self.scoreboard.date)

        # Draw the info
        self.matrix.draw_text_layout(
            self.layout.center_top, 
            date
        )

        end_text = result
        if self.scoreboard.periods.number > 3:
            end_text = "F/{}".format(period)

        self.matrix.draw_text_layout(
            self.layout.period_final, 
            end_text
        )

        self.matrix.draw_text_layout(
            self.layout.score, 
            score
        )

        self.matrix.render()
Exemplo n.º 2
0
    def draw_final(self):
        # Get the Info
        period = self.scoreboard.periods.ordinal
        result = self.scoreboard.periods.clock
        score = '{}-{}'.format(self.scoreboard.away_team.goals, self.scoreboard.home_team.goals)
        date = convert_date_format(self.scoreboard.date)


        # Draw the info
        self.matrix.draw_text(
            (0, -1), date, fill=(255, 255, 255), location="center",
            font=self.font, align="center", multiline=True
        )
        if self.scoreboard.periods.number > 3:
            self.matrix.draw_text(
                (0, 5), "F/{}".format(period), fill=(255, 255, 255), location="center",
                font=self.font, align="center", multiline=True
            )
        else:
            self.matrix.draw_text(
                (0, 5), result, fill=(255, 0, 0), location="center",
                font=self.font, align="center", multiline=True
            )

        self.matrix.draw_text(
            (0, 15), score, fill=(255, 255, 255), location="center",
            font=self.font_large, align="center", multiline=True
        )
        self.matrix.render()
Exemplo n.º 3
0
    def __init__(self, line):

        self.code = line[0].strip()
        self.short_description = line[1].strip()
        self.full_vaccine_name = line[2].strip()
        self.notes = line[3].strip()
        self.status = line[4].strip()
        self.non_vaccine = line[5].strip()
        self.update_date = utils.convert_date_format(line[6], '%Y/%m/%d', '%Y-%m-%d')
    def draw_team_summary(self, stats, prev_game_scoreboard, next_game_scoreboard, bg_color, txt_color, im_height):
        image = Image.new('RGB', (self.matrix.width, im_height))
        draw = ImageDraw.Draw(image)

        draw.rectangle([0, 6, 26, -1], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 0), "RECORD:".format(), fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                  font=self.layout.font)
        draw.text((0, 7), "GP: {} P: {}".format(stats.gamesPlayed, stats.pts), fill=(255, 255, 255),
                  font=self.layout.font)
        draw.text((0, 13), "{}-{}-{}".format(stats.wins, stats.losses, stats.ot), fill=(255, 255, 255),
                  font=self.layout.font)

        draw.rectangle([0, 27, 36, 21], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 21), "LAST GAME:", fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                  font=self.layout.font)
        if prev_game_scoreboard:
            if prev_game_scoreboard.away_team.id == self.team_id:
                draw.text((0, 28), "@ {}".format(prev_game_scoreboard.home_team.abbrev), fill=(255, 255, 255),
                          font=self.layout.font)
            if prev_game_scoreboard.home_team.id == self.team_id:
                draw.text((0, 28), "VS {}".format(prev_game_scoreboard.away_team.abbrev), fill=(255, 255, 255),
                          font=self.layout.font)
            if prev_game_scoreboard.winning_team == self.team_id:
                draw.text((0, 34), "W", fill=(50, 255, 50), font=self.layout.font)
                draw.text((5, 34), "{}-{}".format(prev_game_scoreboard.away_team.goals,
                                                      prev_game_scoreboard.home_team.goals),
                          fill=(255, 255, 255), font=self.layout.font)

            if prev_game_scoreboard.loosing_team == self.team_id:
                draw.text((0, 34), "L", fill=(255, 50, 50), font=self.layout.font)
                draw.text((5, 34), "{}-{}".format(prev_game_scoreboard.away_team.goals,
                                                      prev_game_scoreboard.home_team.goals),
                          fill=(255, 255, 255), font=self.layout.font)

        else:
            draw.text((1, 27), "--------", fill=(200, 200, 200), font=self.layout.font)

        draw.rectangle([0, 48, 36, 42], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 42), "NEXT GAME:", fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                  font=self.layout.font)

        if next_game_scoreboard:
            date = convert_date_format(next_game_scoreboard.date)
            draw.text((0, 49), "{}".format(date), fill=(255, 255, 255), font=self.layout.font)
            draw.text((0, 55), "{}".format(next_game_scoreboard.start_time), fill=(255, 255, 255), font=self.layout.font)
            if next_game_scoreboard.away_team.id == self.team_id:
                draw.text((0, 61), "@ {}".format(next_game_scoreboard.home_team.abbrev), fill=(255, 255, 255),
                          font=self.layout.font)
            if next_game_scoreboard.home_team.id == self.team_id:
                draw.text((0, 61), "VS {}".format(next_game_scoreboard.away_team.abbrev), fill=(255, 255, 255),
                          font=self.layout.font)
        else:
            draw.text((1, 61), "--------", fill=(200, 200, 200), font=self.layout.font)

        return image
Exemplo n.º 5
0
    def draw_team_summary(self, stats, prev_game_scoreboard, next_game_scoreboard, bg_color, txt_color, im_height):
        image = Image.new('RGB', (41, im_height))
        draw = ImageDraw.Draw(image)

        draw.rectangle([0, 6, 26, -1], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 0), "RECORD:".format(), fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                font=self.font)
        if stats:
            draw.text((0, 7), "GP:{} P:{}".format(stats.gamesPlayed, stats.pts), fill=(255, 255, 255),
                font=self.font)
            draw.text((0, 13), "{}-{}-{}".format(stats.wins, stats.losses, stats.ot), fill=(255, 255, 255),
                font=self.font)
        else:
            draw.text((1, 7), "--------", fill=(200, 200, 200), font=self.font)

        draw.rectangle([0, 27, 36, 21], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 21), "LAST GAME:", fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                font=self.font)
        if prev_game_scoreboard:
            if prev_game_scoreboard.away_team.id == self.team_id:
                draw.text((0, 28), "@ {}".format(prev_game_scoreboard.home_team.abbrev), fill=(255, 255, 255),
                        font=self.font)
            if prev_game_scoreboard.home_team.id == self.team_id:
                draw.text((0, 28), "VS {}".format(prev_game_scoreboard.away_team.abbrev), fill=(255, 255, 255),
                        font=self.font)

            if self.data.status.is_irregular(prev_game_scoreboard.status):
                draw.text((0, 34), prev_game_scoreboard.status, fill=(255, 0, 0), font=self.font)

            else:
                if prev_game_scoreboard.winning_team == self.team_id:
                    draw.text((0, 34), "W", fill=(50, 255, 50), font=self.font)
                    draw.text((5, 34), "{}-{}".format(prev_game_scoreboard.away_team.goals,
                                                        prev_game_scoreboard.home_team.goals),
                            fill=(255, 255, 255), font=self.font)

                if prev_game_scoreboard.loosing_team == self.team_id:
                    draw.text((0, 34), "L", fill=(255, 50, 50), font=self.font)
                    draw.text((5, 34), "{}-{}".format(prev_game_scoreboard.away_team.goals,
                                                        prev_game_scoreboard.home_team.goals),
                            fill=(255, 255, 255), font=self.font)

        else:
            draw.text((1, 27), "--------", fill=(200, 200, 200), font=self.font)

        draw.rectangle([0, 48, 36, 42], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, 42), "F**K SHIT:", fill=(txt_color['r'], txt_color['g'], txt_color['b']),
                font=self.font)

        if next_game_scoreboard:
            date = convert_date_format(next_game_scoreboard.date)
            draw.text((0, 49), "{}".format(date.upper()), fill=(255, 255, 255), font=self.font)

            if self.data.status.is_irregular(next_game_scoreboard.status):
                if next_game_scoreboard.status == "Scheduled (Time TBD)":
                    next_game_scoreboard.status = "TBD"
                draw.text((0, 55), "{}".format(next_game_scoreboard.status.upper()), fill=(255, 0, 0), font=self.font)
            else:
                draw.text((0, 55), "{}".format(next_game_scoreboard.start_time), fill=(255, 255, 255), font=self.font)


            if next_game_scoreboard.away_team.id == self.team_id:
                draw.text((0, 61), "@ {}".format(next_game_scoreboard.home_team.abbrev), fill=(255, 255, 255),
                          font=self.font)
            if next_game_scoreboard.home_team.id == self.team_id:
                draw.text((0, 61), "VS {}".format(next_game_scoreboard.away_team.abbrev), fill=(255, 255, 255),
                          font=self.font)
        else:
            draw.text((1, 52), "--------", fill=(200, 200, 200), font=self.font)

        return image