display top 10 or 20 golfers

This commit is contained in:
Justin 2023-05-12 16:20:52 +08:00 committed by GitHub
parent a1015a617c
commit f538730758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3205,7 +3205,7 @@ class StockTicker():
imgs = [title_img, self.blank] imgs = [title_img, self.blank]
else: else:
imgs = [] imgs = []
ten_or_twenty = slice(None)
for league in leagues: for league in leagues:
try: try:
@ -3215,10 +3215,26 @@ class StockTicker():
if league == 'PGA': if league == 'PGA':
league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB')
try:
if all_settings['top20'] == 10:
ten_or_twenty = slice(10)
else:
ten_or_twenty = slice(None)
except:
ten_or_twenty = slice(None)
elif league == 'LPGA': elif league == 'LPGA':
league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB')
try:
if all_settings['top20'] == 10:
ten_or_twenty = slice(10)
else:
ten_or_twenty = slice(None)
except:
ten_or_twenty = slice(None)
else: else:
league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB')
ten_or_twenty = slice(None)
img.paste(league_logo, (x_offset,0)) img.paste(league_logo, (x_offset,0))
x_offset += league_logo.size[0] +self.blank.size[0] x_offset += league_logo.size[0] +self.blank.size[0]
@ -3235,7 +3251,7 @@ class StockTicker():
pass pass
buff_size = 20 buff_size = 20
for team in team_info: for team in team_info[ten_or_twenty]:
if league == 'PGA' or league =='LPGA': if league == 'PGA' or league =='LPGA':
pga_font = ImageFont.load("./fonts/7x14.pil") pga_font = ImageFont.load("./fonts/7x14.pil")
pga_small = ImageFont.load("./fonts/5x8.pil") pga_small = ImageFont.load("./fonts/5x8.pil")