quotes and quotes prof done
This commit is contained in:
parent
ca2cbce648
commit
1b8c948aaa
@ -7740,6 +7740,32 @@ class StockTicker():
|
|||||||
image_list = [title_img]
|
image_list = [title_img]
|
||||||
else:
|
else:
|
||||||
image_list = []
|
image_list = []
|
||||||
|
font = ImageFont.load("./fonts/8x13B.pil")
|
||||||
|
font2 = ImageFont.load("./fonts/6x10.pil")
|
||||||
|
sun_img = self.openImage('logos/sun_quote.png')
|
||||||
|
try:
|
||||||
|
for index, each in enumerate(quotes_settings['quotes']):
|
||||||
|
if index == 0:
|
||||||
|
quote_img = self.textImage(each['quote'], font, 248, 152, 128)
|
||||||
|
author_img = self.textImage(each['author'], font2, 64, 181, 173)
|
||||||
|
img = Image.new('RGB', (max(quote_img.size[0], author_img.size[0]) + 20,32))
|
||||||
|
img.paste(quote_img, (0,7))
|
||||||
|
img.paste(author_img, ((quote_img.size[0] - author_img.size[0] - 5), 21))
|
||||||
|
image_list.append(img)
|
||||||
|
else:
|
||||||
|
quote_img = self.textImage(each['quote'], font, 248, 152, 128)
|
||||||
|
author_img = self.textImage(each['author'], font2, 64, 181, 173)
|
||||||
|
img = Image.new('RGB', (sun_img.size[0] + 5+ max(quote_img.size[0], author_img.size[0]) + 20,32))
|
||||||
|
img.paste(sun_img, (0, 0))
|
||||||
|
img.paste(quote_img, (sun_img.size[0] + 5,7))
|
||||||
|
img.paste(author_img, (sun_img.size[0] + 5+(quote_img.size[0] - author_img.size[0] - 5), 21))
|
||||||
|
image_list.append(img)
|
||||||
|
except:
|
||||||
|
img = Image.new('RGB',(180,32))
|
||||||
|
no_quotes = self.textImage('No quotes available.', font, 255, 255, 255)
|
||||||
|
img.paste(no_quotes,(0,7))
|
||||||
|
image_list.append(img)
|
||||||
|
pass
|
||||||
|
|
||||||
return self.stitchImage(image_list)
|
return self.stitchImage(image_list)
|
||||||
|
|
||||||
@ -7755,6 +7781,33 @@ class StockTicker():
|
|||||||
image_list = [title_img]
|
image_list = [title_img]
|
||||||
else:
|
else:
|
||||||
image_list = []
|
image_list = []
|
||||||
|
font = ImageFont.load("./fonts/5x8.pil")
|
||||||
|
font2 = ImageFont.load("./fonts/4x6.pil")
|
||||||
|
sun_img = self.openImage('logos/sun_quote_small.png')
|
||||||
|
|
||||||
|
try:
|
||||||
|
for index, each in enumerate(quotes_settings['quotes']):
|
||||||
|
if index == 0:
|
||||||
|
quote_img = self.textImage(each['quote'], font, 248, 152, 128)
|
||||||
|
author_img = self.textImage(each['author'], font2, 64, 181, 173)
|
||||||
|
img = Image.new('RGB', (max(quote_img.size[0], author_img.size[0]) + 15,16))
|
||||||
|
img.paste(quote_img, (0,0))
|
||||||
|
img.paste(author_img, ((quote_img.size[0] - author_img.size[0] - 5), 10))
|
||||||
|
image_list.append(img)
|
||||||
|
else:
|
||||||
|
quote_img = self.textImage(each['quote'], font, 248, 152, 128)
|
||||||
|
author_img = self.textImage(each['author'], font2, 64, 181, 173)
|
||||||
|
img = Image.new('RGB', (sun_img.size[0] + 5+ max(quote_img.size[0], author_img.size[0]) + 15,16))
|
||||||
|
img.paste(sun_img, (0, 0))
|
||||||
|
img.paste(quote_img, (sun_img.size[0] + 5,0))
|
||||||
|
img.paste(author_img, (sun_img.size[0] + 5+(quote_img.size[0] - author_img.size[0] - 5), 10))
|
||||||
|
image_list.append(img)
|
||||||
|
except:
|
||||||
|
img = Image.new('RGB',(180,16))
|
||||||
|
no_quotes = self.textImage('No quotes available.', font, 255, 255, 255)
|
||||||
|
img.paste(no_quotes,(0,0))
|
||||||
|
image_list.append(img)
|
||||||
|
pass
|
||||||
|
|
||||||
return self.stitchImage(image_list)
|
return self.stitchImage(image_list)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user