This commit is contained in:
Your Name
2021-06-30 22:00:14 +01:00
parent 159c23bb3f
commit 2b3fff395a
12 changed files with 12 additions and 7 deletions

Binary file not shown.

BIN
display_images/daily_weather.ppm Normal file → Executable file

Binary file not shown.

0
display_images/display_gif.ppm Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

0
display_images/league_games.ppm Normal file → Executable file
View File

0
display_images/league_table.ppm Normal file → Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
display_images/text.ppm Normal file → Executable file
View File

BIN
display_images/today_weather.ppm Normal file → Executable file

Binary file not shown.

View File

@@ -10,6 +10,9 @@ import sys, select
import os import os
import threading import threading
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
Image.init()
print(Image.SAVE.keys())
import time import time
import csv import csv
import requests import requests
@@ -198,9 +201,11 @@ class StockTicker():
def updateMultiple(self, options): def updateMultiple(self, options):
for option in options: for option in options:
print(option)
print('display_images/' + option + '.ppm')
if option not in ['display_gif']: if option not in ['display_gif']:
img = self.functions[option]() img = self.functions[option]()
img.save('display_images/' + option + '.ppm') img.save('./display_images/'+ option+ '.ppm')
def checkKilled(self): def checkKilled(self):
@@ -220,7 +225,7 @@ class StockTicker():
def scrollFunctionsAnimated(self, options, animation = 'continuous'): def scrollFunctionsAnimated(self, options, animation = 'continuous'):
# scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed # scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed
self.updateMultiple(options) self.updateMultiple([options[0]])
kill = False kill = False
@@ -231,10 +236,10 @@ class StockTicker():
update_process.start() update_process.start()
image = self.openImage('display_images/' + options[i % len(options)] +'.ppm') image = self.openImage('./display_images/' + options[i % len(options)] +'.ppm')
if animation == 'continuous': if animation == 'continuous':
image2 = self.openImage('display_images/' + options[(i + 1) % len(options)] +'.ppm') image2 = self.openImage('./display_images/' + options[(i + 1) % len(options)] +'.ppm')
img_width, img_height = image.size img_width, img_height = image.size
offset_x = 0 offset_x = 0
@@ -1522,7 +1527,7 @@ class StockTicker():
title_img = self.openImage('feature_titles/images.png') title_img = self.openImage('feature_titles/images.png')
image = self.openImage(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/display_image.ppm')) image = self.openImage(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/user_image.ppm'))
return self.stitchImage([title_img, image]) return self.stitchImage([title_img, image])
def getUserGIF(self): def getUserGIF(self):
@@ -1636,7 +1641,7 @@ class StockTicker():
userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo
#userSettings = ['stocks', 'crypto'] # these wil be read from csv, just for demo #userSettings = ['stocks', 'crypto'] # these wil be read from csv, just for demo
userSettings = [ 'display_image', 'news'] # these wil be read from csv, just for demo #userSettings = [ 'display_image', 'news'] # these wil be read from csv, just for demo
self.scrollFunctionsAnimated(userSettings, animation = 'down') self.scrollFunctionsAnimated(userSettings, animation = 'down')
@@ -1652,7 +1657,7 @@ if __name__ == '__main__':
#stock_ticker.process_msg(P') #stock_ticker.process_msg(P')
#stock_ticker.process_msg('G') #stock_ticker.process_msg('G')
#stock_ticker.process_msg('f') #stock_ticker.process_msg('f')
stock_ticker.process_msg('A') #stock_ticker.process_msg('A')