added display names to prof display

This commit is contained in:
Justin 2023-09-14 15:03:07 +08:00 committed by GitHub
parent 7bd39c58d5
commit 90cf3de2fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1371,9 +1371,18 @@ class StockTicker():
else:
current = str(current_final)
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if names:
try:
ticker = coin_info[cb]['name'].upper()
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
except:
ticker, base = cb.split(',')
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
else:
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if all_crypto_settings['logos']:
try:
ticker, base = cb.split(',')
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
@ -2396,7 +2405,6 @@ class StockTicker():
f.close()
except:
pass
try:
if all_stocks_settings['prepost']:
try:
@ -2426,8 +2434,13 @@ class StockTicker():
info = stock_info[symbol]
change = float(info['change'])#TEXT
ticker = symbol #TEXT
if names:
try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else:
ticker = symbol
arrow, change = self.getArrow(change, professional=True)
if all_stocks_settings["percent"]:
@ -2435,11 +2448,11 @@ class StockTicker():
else:
change = '%.2f' % abs(change)
current = '%.2f' % float(info['current']) #TEXT
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if all_stocks_settings['logos']:
ticker = symbol
try:
try: #load the tiny logo
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
@ -2457,11 +2470,9 @@ class StockTicker():
logo = logo.resize((int(width/2), int(height/2)))
stitchedStock = self.stitchImage([logo,midFrame])
except Exception as e:
stitchedStock = midFrame
else:
stitchedStock = midFrame
try:
if all_stocks_settings['lohivol']:
font = ImageFont.load("./fonts/4x6.pil")
@ -2487,7 +2498,6 @@ class StockTicker():
pass
except:
pass
try:
if all_stocks_settings['prepost']:
font = ImageFont.load("./fonts/5x8.pil")
@ -2525,7 +2535,6 @@ class StockTicker():
prepost_img.paste(prechange_img, (preprice_img.size[0] + arrow.size[0] + 2,7))
except:
pass
elif ((timenow < "04:00:00" or timenow > "16:00:00") and (weekday <= 4)) or (weekday > 4): #postmarket
try:
postprice = '%.2f' % abs(float(prepost_settings[symbol]['Post-market']['postprice']))
@ -2559,10 +2568,8 @@ class StockTicker():
prepost_img.paste(postchange_img, (postprice_img.size[0] + arrow.size[0] + 2,7))
except:
pass
except:
pass
try:
if all_stocks_settings['chart'] and (symbol in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO
try:
@ -7004,8 +7011,13 @@ class StockTicker():
try:
info = active_info[symbol]
change = float(info['change'])#TEXT
ticker = symbol #TEXT
if names:
try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else:
ticker = symbol
arrow, change = self.getArrow(change, professional=True)
if market_settings["percent"]:
@ -7017,16 +7029,13 @@ class StockTicker():
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if market_settings['logos']:
ticker = symbol
try:
try: #load the tiny logo
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
except: # load the big logo and scale it
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
# half the size of the logo
width, height = logo.size
@ -7083,7 +7092,13 @@ class StockTicker():
try:
info = losers_info[symbol]
change = float(info['change'])#TEXT
ticker = symbol #TEXT
if names:
try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else:
ticker = symbol
arrow, change = self.getArrow(change, professional=True)
@ -7096,6 +7111,7 @@ class StockTicker():
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if market_settings['logos']:
ticker = symbol
try:
try: #load the tiny logo
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
@ -7161,7 +7177,13 @@ class StockTicker():
try:
info = gainers_info[symbol]
change = float(info['change'])#TEXT
ticker = symbol #TEXT
if names:
try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else:
ticker = symbol
arrow, change = self.getArrow(change, professional=True)
if market_settings["percent"]:
change = '%.2f' % abs(float(info['percent_change'])) + '%'
@ -7171,6 +7193,7 @@ class StockTicker():
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if market_settings['logos']:
ticker = symbol
try:
try: #load the tiny logo
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')