prof added display_names
This commit is contained in:
parent
90cf3de2fd
commit
a47c8a8d53
@ -1025,6 +1025,25 @@ class StockTicker():
|
|||||||
newWidth = max(w2 + text_width_change, text_width_current) +15
|
newWidth = max(w2 + text_width_change, text_width_current) +15
|
||||||
img = img.crop((0,0,newWidth,32))
|
img = img.crop((0,0,newWidth,32))
|
||||||
|
|
||||||
|
elif 'display_name' in TICKER:
|
||||||
|
TICKER = TICKER.replace('display_name','')
|
||||||
|
w1, text_height = self.get_text_dimensions(TICKER, font)
|
||||||
|
w2, text_height = self.get_text_dimensions(CURRENT, font)
|
||||||
|
text_width_current = max(w1,w2)
|
||||||
|
|
||||||
|
img = Image.new('RGB', (text_width_current +100 , 32))
|
||||||
|
d = ImageDraw.Draw(img)
|
||||||
|
|
||||||
|
d.text((4, 0), TICKER, fill=(255, 255, 255), font=font)
|
||||||
|
d.text((4, 8), CURRENT, fill=self.greenORred, font=font)
|
||||||
|
|
||||||
|
img.paste(ARROW, ((w2 + 7),10))
|
||||||
|
d.text(((w2+18), 8), CHANGE, fill=self.greenORred, font=font)
|
||||||
|
|
||||||
|
text_width_change, text_height = self.get_text_dimensions(CHANGE, font)
|
||||||
|
newWidth = max(w2 + 15 + text_width_change, text_width_current) +15
|
||||||
|
img = img.crop((0,0,newWidth,32))
|
||||||
|
|
||||||
elif 'Sector' in CHANGE:
|
elif 'Sector' in CHANGE:
|
||||||
w1, text_height = self.get_text_dimensions(TICKER, font)
|
w1, text_height = self.get_text_dimensions(TICKER, font)
|
||||||
w2, text_height = self.get_text_dimensions(CURRENT, font)
|
w2, text_height = self.get_text_dimensions(CURRENT, font)
|
||||||
@ -1373,7 +1392,7 @@ class StockTicker():
|
|||||||
|
|
||||||
if names:
|
if names:
|
||||||
try:
|
try:
|
||||||
ticker = coin_info[cb]['name'].upper()
|
ticker = coin_info[cb]['name'].upper() + 'display_name'
|
||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
except:
|
except:
|
||||||
ticker, base = cb.split(',')
|
ticker, base = cb.split(',')
|
||||||
@ -2436,7 +2455,7 @@ class StockTicker():
|
|||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
if names:
|
if names:
|
||||||
try:
|
try:
|
||||||
ticker = info['name'].upper() #TEXT
|
ticker = info['name'].upper() + 'display_name' #TEXT
|
||||||
except:
|
except:
|
||||||
ticker = symbol
|
ticker = symbol
|
||||||
else:
|
else:
|
||||||
@ -7013,7 +7032,7 @@ class StockTicker():
|
|||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
if names:
|
if names:
|
||||||
try:
|
try:
|
||||||
ticker = info['name'].upper() #TEXT
|
ticker = info['name'].upper() + 'display_name' #TEXT
|
||||||
except:
|
except:
|
||||||
ticker = symbol
|
ticker = symbol
|
||||||
else:
|
else:
|
||||||
@ -7094,7 +7113,7 @@ class StockTicker():
|
|||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
if names:
|
if names:
|
||||||
try:
|
try:
|
||||||
ticker = info['name'].upper() #TEXT
|
ticker = info['name'].upper() + 'display_name' #TEXT
|
||||||
except:
|
except:
|
||||||
ticker = symbol
|
ticker = symbol
|
||||||
else:
|
else:
|
||||||
@ -7179,7 +7198,7 @@ class StockTicker():
|
|||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
if names:
|
if names:
|
||||||
try:
|
try:
|
||||||
ticker = info['name'].upper() #TEXT
|
ticker = info['name'].upper() + 'display_name' #TEXT
|
||||||
except:
|
except:
|
||||||
ticker = symbol
|
ticker = symbol
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user