Skip to content

Commit

Permalink
Merge pull request #162 from MLB-LED-Scoreboard/dev
Browse files Browse the repository at this point in the history
Release 1.5.1
  • Loading branch information
ajbowler authored May 15, 2018
2 parents 6bf7018 + 61e5601 commit e1f01cf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
Binary file added Assets/fire.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import debug

SCRIPT_NAME = "MLB LED Scoreboard"
SCRIPT_VERSION = "1.5.0"
SCRIPT_VERSION = "1.5.1"

# Get supplied command line arguments
args = args()
Expand Down
28 changes: 23 additions & 5 deletions renderers/standings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from PIL import Image
from rgbmatrix import graphics
from utils import get_font
from utils import get_font, get_file
import time

class StandingsRenderer:
Expand All @@ -17,10 +18,13 @@ def __init__(self, matrix, canvas, data):
def render(self):
self.canvas.Fill(self.bg_color["r"], self.bg_color["g"], self.bg_color["b"])

if self.canvas.width > 32:
self.__render_static_wide_standings()
if self.__is_dumpster_fire():
self.__render_dumpster_fire()
else:
self.__render_rotating_standings()
if self.canvas.width > 32:
self.__render_static_wide_standings()
else:
self.__render_rotating_standings()

def __render_rotating_standings(self):
coords = self.data.config.layout.coords("standings")
Expand Down Expand Up @@ -53,7 +57,7 @@ def __render_static_wide_standings(self):
coords = self.data.config.layout.coords("standings")
font = self.data.config.layout.font("standings")
while True:
offset = coords["offset"]
offset = coords["offset"]

for team in self.data.standings_for_preferred_division().teams:
team_text = team.team_abbrev
Expand All @@ -73,3 +77,17 @@ def __render_static_wide_standings(self):
self.matrix.SwapOnVSync(self.canvas)

time.sleep(20.0)

def __is_dumpster_fire(self):
return "comedy" in self.data.config.preferred_division.lower()

def __render_dumpster_fire(self):
image_file = get_file("Assets/fire.jpg")
image = Image.open(image_file)
image_rgb = image.convert("RGB")
image_x = (self.canvas.width / 2) - 16

self.matrix.Clear()
while True:
self.matrix.SetImage(image_rgb, image_x, 0)
time.sleep(20.0)
7 changes: 6 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import collections
import argparse
import os
import debug

def get_file(path):
dir = os.path.dirname(__file__)
Expand Down Expand Up @@ -58,7 +59,11 @@ def led_matrix_options(args):
options.brightness = args.led_brightness
options.pwm_lsb_nanoseconds = args.led_pwm_lsb_nanoseconds
options.led_rgb_sequence = args.led_rgb_sequence
options.pixel_mapper_config = args.led_pixel_mapper
try:
options.pixel_mapper_config = args.led_pixel_mapper
except AttributeError:
debug.warning("Your compiled RGB Matrix Library is out of date.")
debug.warning("The --led-pixel-mapper argument will not work until it is updated.")

if args.led_show_refresh:
options.show_refresh_rate = 1
Expand Down

0 comments on commit e1f01cf

Please sign in to comment.