professional diaply working
This commit is contained in:
parent
9d9306245e
commit
e1e17d0df2
@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 41.17, "24hr_change": -0.8456587230187674}, "BTC,USD": {"current": 58006, "24hr_change": 0.3176129592444612}, "ETH,BTC": {"current": 0.07311235, "24hr_change": 0.7542195107438717}, "ADA,GBP": {"current": 1.4, "24hr_change": 1.2844510982491046}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 40.18, "24hr_change": -5.751214034292039}, "BTC,USD": {"current": 56312, "24hr_change": -5.868224745675183}, "ETH,BTC": {"current": 0.07319404, "24hr_change": -5.605857292449335}, "ADA,GBP": {"current": 1.33, "24hr_change": -5.444920011868605}}}
|
@ -1 +1 @@
|
|||||||
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 3.94, "min_temp": 3.94, "max_temp": 8.81, "feels_like": 3.94, "humidity": 51, "clouds": 100, "wind_speed": 1.24, "wind_direction": 139, "visibility": 10000, "uv": 0, "rain_chance": 0.03}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 10.09, "min_temp": 8.65, "max_temp": 11.15, "feels_like": 9.32, "humidity": 83, "clouds": 90, "wind_speed": 3.6, "wind_direction": 280, "visibility": 10000, "uv": 0.15, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "few clouds", "temp": 12.97, "min_temp": 12.97, "max_temp": 16.47, "feels_like": 12.2, "humidity": 72, "clouds": 20, "wind_speed": 0.89, "wind_direction": 78, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 1.24, "min_temp": 0.15, "max_temp": 1.24, "feels_like": -4.66, "humidity": 91, "clouds": 100, "wind_speed": 7.86, "wind_direction": 321, "visibility": 10000, "uv": 0, "rain_chance": 0.9}}, "current_weather": true}
|
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clear", "description": "clear sky", "temp": -7.06, "min_temp": -7.06, "max_temp": 7.02, "feels_like": -10.16, "humidity": 24, "clouds": 0, "wind_speed": 1.69, "wind_direction": 301, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Clouds", "description": "broken clouds", "temp": -2.92, "min_temp": -3.71, "max_temp": -0.38, "feels_like": -7.99, "humidity": 77, "clouds": 72, "wind_speed": 4.16, "wind_direction": 298, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 5.62, "min_temp": 4.84, "max_temp": 9.55, "feels_like": 5.62, "humidity": 89, "clouds": 100, "wind_speed": 0.45, "wind_direction": 58, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "broken clouds", "temp": 13.22, "min_temp": 12.06, "max_temp": 15.34, "feels_like": 12.06, "humidity": 56, "clouds": 75, "wind_speed": 3.13, "wind_direction": 326, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}
|
@ -1 +1 @@
|
|||||||
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 3.94, "max_temp": 8.81}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.45, "max_temp": 7.54}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 0.17, "max_temp": 3.41}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.49, "max_temp": 7.39}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 1.3, "max_temp": 7.49}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 3.47, "max_temp": 10.49}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 3.41, "max_temp": 9.49}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 1.39, "max_temp": 6.74}], "London": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 8.65, "max_temp": 11.15}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 4.85, "max_temp": 9.55}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 4.65, "max_temp": 9.51}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.93, "max_temp": 8.97}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.56, "max_temp": 8.24}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.06, "max_temp": 8.16}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 2.55, "max_temp": 5.05}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.76, "max_temp": 6.97}], "Tokyo": [{"main_weather": "Rain", "description": "light rain", "min_temp": 12.97, "max_temp": 16.47}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 14.97, "max_temp": 19.03}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.66, "max_temp": 15.7}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.62, "max_temp": 14.74}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.8, "max_temp": 14.25}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.77, "max_temp": 15.55}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 11.35, "max_temp": 17.33}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.32, "max_temp": 13.98}], "Moscow": [{"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.15, "max_temp": 1.24}, {"main_weather": "Snow", "description": "snow", "min_temp": 0.23, "max_temp": 1.38}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.68, "max_temp": 0.51}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": -6.8, "max_temp": -4.63}, {"main_weather": "Snow", "description": "light snow", "min_temp": -6.12, "max_temp": 0.48}, {"main_weather": "Snow", "description": "light snow", "min_temp": 0.48, "max_temp": 2.15}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.78, "max_temp": 2.11}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.05, "max_temp": -3.1}]}, "current_weather": true}
|
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clear", "description": "clear sky", "min_temp": -7.06, "max_temp": 7.02}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 1.15, "max_temp": 8.89}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 2.62, "max_temp": 9.18}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 3.78, "max_temp": 10.53}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 3.22, "max_temp": 9.12}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 4.77, "max_temp": 9.55}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.55, "max_temp": 7.18}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 2, "max_temp": 7.95}], "Moscow": [{"main_weather": "Clouds", "description": "broken clouds", "min_temp": -3.71, "max_temp": -0.38}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": -6.45, "max_temp": -3.11}, {"main_weather": "Snow", "description": "snow", "min_temp": -5.88, "max_temp": 0.57}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 0.8, "max_temp": 1.59}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": -0.24, "max_temp": 1.77}, {"main_weather": "Snow", "description": "light snow", "min_temp": -0.44, "max_temp": 1.89}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.19, "max_temp": 2.4}, {"main_weather": "Rain", "description": "light rain", "min_temp": 0.79, "max_temp": 2.9}], "London": [{"main_weather": "Clear", "description": "clear sky", "min_temp": 4.84, "max_temp": 9.55}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 4.53, "max_temp": 9.03}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 4.25, "max_temp": 8.04}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 3.91, "max_temp": 6.74}, {"main_weather": "Rain", "description": "light rain", "min_temp": 1.82, "max_temp": 6.47}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 2.03, "max_temp": 3.64}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.3, "max_temp": 4.59}, {"main_weather": "Rain", "description": "light rain", "min_temp": 1.9, "max_temp": 8.71}], "Tokyo": [{"main_weather": "Rain", "description": "light rain", "min_temp": 12.06, "max_temp": 15.34}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.48, "max_temp": 15.59}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.66, "max_temp": 15.5}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.38, "max_temp": 14.9}, {"main_weather": "Rain", "description": "light rain", "min_temp": 10.57, "max_temp": 13.45}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 8.53, "max_temp": 13.12}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 8.1, "max_temp": 13.65}, {"main_weather": "Rain", "description": "light rain", "min_temp": 10.92, "max_temp": 17.44}]}, "current_weather": true}
|
@ -1 +1 @@
|
|||||||
["Stocks", "Crypto"]
|
["Professional", [["Daily Forecast", "News", "Stocks"], ["Crypto"]]]
|
@ -1 +1 @@
|
|||||||
{"stocks": "20/11/2021 10:13:08", "crypto": "20/11/2021 10:23:46", "news": "20/11/2021 10:13:16", "weather": "20/11/2021 10:13:13", "forex": "20/11/2021 16:13:20", "sports": "20/11/2021 10:13:17"}
|
{"stocks": "22/11/2021 14:06:10", "crypto": "22/11/2021 14:04:13", "news": "22/11/2021 14:04:16", "weather": "22/11/2021 14:04:14", "forex": "22/11/2021 20:04:19", "sports": "22/11/2021 14:04:16"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
|||||||
speed,brightness
|
speed,brightness
|
||||||
f,9
|
f,3
|
|
@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 343.2, "opening": 342.74}, "GOOG": {"current": 2999.02, "opening": 3020.64}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 343.04, "opening": 344.57}, "GOOG": {"current": 2957, "opening": 3006.525}}}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
log.txt
13
log.txt
@ -0,0 +1,13 @@
|
|||||||
|
[Errno 2] No such file or directory: './display_images/Daily Forecast Prof.ppm'. file: stockTicker.py. line: 2480. type: <class 'FileNotFoundError'>
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "stockTicker.py", line 2480, in <module>
|
||||||
|
stock_ticker.process_msg(msg)
|
||||||
|
File "stockTicker.py", line 2439, in process_msg
|
||||||
|
self.scrollProfessionalAnimated(userSettings[1])
|
||||||
|
File "stockTicker.py", line 452, in scrollProfessionalAnimated
|
||||||
|
image1 = self.openImage('./display_images/' + top[i1 % len(top)] +' Prof.ppm')
|
||||||
|
File "stockTicker.py", line 87, in openImage
|
||||||
|
image = Image.open(image_file)
|
||||||
|
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2634, in open
|
||||||
|
fp = builtins.open(filename, "rb")
|
||||||
|
FileNotFoundError: [Errno 2] No such file or directory: './display_images/Daily Forecast Prof.ppm'
|
79
server.py
79
server.py
@ -56,34 +56,45 @@ def process_file(path, filename):
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@app.route("/", methods=['GET', 'POST'])
|
@app.route("/", methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
global command
|
global command
|
||||||
all_features = ['Current Weather','Daily Forecast','News', 'Sports (Upcoming Games)','Sports (Past Games)','Sports (Live Games)',
|
all_features = ['Current Weather','Daily Forecast','News', 'Sports (Upcoming Games)','Sports (Past Games)','Sports (Live Games)',
|
||||||
'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex']
|
'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex']
|
||||||
|
|
||||||
currently_displaying = json.load(open('csv/display_settings.json', 'r'))
|
global professional
|
||||||
not_displaying = [f for f in all_features if f not in currently_displaying]
|
|
||||||
|
|
||||||
now = datetime.datetime.now()
|
feature_settings = json.load(open('csv/display_settings.json', 'r'))
|
||||||
timeString = now.strftime("%Y-%m-%d %H:%M")
|
|
||||||
logos_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos')
|
|
||||||
LogoList = os.listdir(logos_path)
|
|
||||||
|
|
||||||
stocks_settings = json.load(open('csv/stocks_settings.json', 'r'))
|
if not professional:
|
||||||
crypto_settings = json.load(open('csv/crypto_settings.json', 'r'))
|
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
||||||
forex_settings = json.load(open('csv/forex_settings.json', 'r'))
|
not_displaying = [f for f in all_features if f not in currently_displaying]
|
||||||
current_weather= json.load(open('csv/current_weather.json', 'r'))
|
|
||||||
daily_weather = json.load(open('csv/daily_weather.json', 'r'))
|
elif professional:
|
||||||
news_settings = json.load(open('csv/news_settings.json', 'r'))
|
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
||||||
upcoming_games = json.load(open('csv/upcoming_games.json', 'r'))
|
not_displaying = [f for f in all_features if f not in currently_displaying[0] and f not in currently_displaying[1]]
|
||||||
live_games = json.load(open('csv/live_games.json', 'r'))
|
|
||||||
past_games = json.load(open('csv/past_games.json', 'r'))
|
|
||||||
team_stats = json.load(open('csv/league_tables.json', 'r'))
|
|
||||||
image_settings = json.load(open('csv/image_settings.json', 'r'))
|
|
||||||
GIF_settings = json.load(open('csv/GIF_settings.json', 'r'))
|
|
||||||
message_settings = json.load(open('csv/message_settings.json', 'r'))
|
|
||||||
|
|
||||||
|
|
||||||
templateData = {
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
timeString = now.strftime("%Y-%m-%d %H:%M")
|
||||||
|
logos_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos')
|
||||||
|
LogoList = os.listdir(logos_path)
|
||||||
|
|
||||||
|
stocks_settings = json.load(open('csv/stocks_settings.json', 'r'))
|
||||||
|
crypto_settings = json.load(open('csv/crypto_settings.json', 'r'))
|
||||||
|
forex_settings = json.load(open('csv/forex_settings.json', 'r'))
|
||||||
|
current_weather= json.load(open('csv/current_weather.json', 'r'))
|
||||||
|
daily_weather = json.load(open('csv/daily_weather.json', 'r'))
|
||||||
|
news_settings = json.load(open('csv/news_settings.json', 'r'))
|
||||||
|
upcoming_games = json.load(open('csv/upcoming_games.json', 'r'))
|
||||||
|
live_games = json.load(open('csv/live_games.json', 'r'))
|
||||||
|
past_games = json.load(open('csv/past_games.json', 'r'))
|
||||||
|
team_stats = json.load(open('csv/league_tables.json', 'r'))
|
||||||
|
image_settings = json.load(open('csv/image_settings.json', 'r'))
|
||||||
|
GIF_settings = json.load(open('csv/GIF_settings.json', 'r'))
|
||||||
|
message_settings = json.load(open('csv/message_settings.json', 'r'))
|
||||||
|
|
||||||
|
|
||||||
|
templateData = {
|
||||||
'currently_displaying': currently_displaying,
|
'currently_displaying': currently_displaying,
|
||||||
'not_displaying': not_displaying,
|
'not_displaying': not_displaying,
|
||||||
'stocks_settings': stocks_settings,
|
'stocks_settings': stocks_settings,
|
||||||
@ -98,9 +109,10 @@ def index():
|
|||||||
'team_stats': team_stats,
|
'team_stats': team_stats,
|
||||||
'image_settings':image_settings,
|
'image_settings':image_settings,
|
||||||
'GIF_settings':GIF_settings,
|
'GIF_settings':GIF_settings,
|
||||||
'message_settings':message_settings
|
'message_settings':message_settings,
|
||||||
|
'professional':professional
|
||||||
}
|
}
|
||||||
return render_template('index.html', **templateData)
|
return render_template('index.html', **templateData)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +122,7 @@ def start():
|
|||||||
global displaying_screensaver
|
global displaying_screensaver
|
||||||
global ticker
|
global ticker
|
||||||
global api_caller
|
global api_caller
|
||||||
|
global professional
|
||||||
if displaying_screensaver:
|
if displaying_screensaver:
|
||||||
screensaver_p.close()
|
screensaver_p.close()
|
||||||
api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
|
api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
|
||||||
@ -117,7 +130,7 @@ def start():
|
|||||||
displaying_screensaver = False
|
displaying_screensaver = False
|
||||||
|
|
||||||
|
|
||||||
print(professional)
|
|
||||||
data = str(request.data)
|
data = str(request.data)
|
||||||
|
|
||||||
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
|
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
|
||||||
@ -126,21 +139,15 @@ def start():
|
|||||||
if professional:
|
if professional:
|
||||||
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'News']
|
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'News']
|
||||||
|
|
||||||
|
print(professional)
|
||||||
positions = []
|
positions = []
|
||||||
display_settings = []
|
display_settings = []
|
||||||
|
data = str(request.data.decode('utf-8'))
|
||||||
|
|
||||||
for setting in all_settings:
|
input_settings = json.loads(data)
|
||||||
pos = data.find(setting)
|
|
||||||
if pos != -1:
|
|
||||||
if professional:
|
|
||||||
setting += ' Prof'
|
|
||||||
display_settings.append(setting)
|
|
||||||
positions.append(pos)
|
|
||||||
|
|
||||||
# sort settings by display
|
s = "Professional" if professional else "Standard"
|
||||||
inds = np.argsort(positions)
|
display_settings = [s] + [input_settings]
|
||||||
display_settings = np.array(display_settings)[inds]
|
|
||||||
|
|
||||||
with open('csv/display_settings.json', 'w+') as f:
|
with open('csv/display_settings.json', 'w+') as f:
|
||||||
json.dump(list(display_settings), f)
|
json.dump(list(display_settings), f)
|
||||||
|
@ -794,11 +794,38 @@ allFeaturesTextAddBtn.map((value, index) => {
|
|||||||
var startButton = document.getElementById("start-btn");
|
var startButton = document.getElementById("start-btn");
|
||||||
// start the display
|
// start the display
|
||||||
startButton.addEventListener("click", () => {
|
startButton.addEventListener("click", () => {
|
||||||
var HTML = document.getElementById("display-format").innerHTML;
|
|
||||||
fetch("/start", {
|
let opt = getSelected(displayFormats);
|
||||||
method: "PUT",
|
|
||||||
body: JSON.stringify(HTML),
|
if (opt.includes("Standard")) {
|
||||||
});
|
var list_el = document.getElementById("display-format");
|
||||||
|
|
||||||
|
let features = getListItems(list_el);
|
||||||
|
fetch("/start", {
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify(features),
|
||||||
|
});
|
||||||
|
} else if (opt.includes("Professional")) {
|
||||||
|
|
||||||
|
var top_list_el = document.getElementById("display-format");
|
||||||
|
|
||||||
|
let top_features = getListItems(top_list_el);
|
||||||
|
|
||||||
|
|
||||||
|
var bot_list_el = document.getElementById("display-format-2");
|
||||||
|
|
||||||
|
let bot_features = getListItems(bot_list_el);
|
||||||
|
|
||||||
|
|
||||||
|
let features = [top_features, bot_features];
|
||||||
|
|
||||||
|
|
||||||
|
fetch("/start", {
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify(features),
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var brightnessButton = document.getElementById("brightness-btn");
|
var brightnessButton = document.getElementById("brightness-btn");
|
||||||
|
@ -45,17 +45,11 @@ class StockTicker():
|
|||||||
self.blank = Image.new('RGB', (10, 32))
|
self.blank = Image.new('RGB', (10, 32))
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
|
|
||||||
settings = open('csv/settings.csv')
|
settings = open('csv/settings.csv')
|
||||||
|
|
||||||
line = settings.readlines()[1]
|
line = settings.readlines()[1]
|
||||||
|
|
||||||
|
|
||||||
self.brightness = (float(line[2])+1)*10
|
self.brightness = (float(line[2])+1)*10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Configuration for the matrix
|
# Configuration for the matrix
|
||||||
options = RGBMatrixOptions()
|
options = RGBMatrixOptions()
|
||||||
options.rows = 32
|
options.rows = 32
|
||||||
@ -440,32 +434,35 @@ class StockTicker():
|
|||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
top = options[0]
|
||||||
|
bottom = options[1]
|
||||||
|
|
||||||
|
|
||||||
self.updateMultiple(options[0:2])
|
|
||||||
|
self.updateMultiple([top[0], bottom[0]])
|
||||||
|
|
||||||
kill = False
|
kill = False
|
||||||
i1 = 0 # keep track of which image we are displaying
|
i1 = 0 # keep track of which image we are displaying
|
||||||
i2 = 1 # keep track of which image we are displaying
|
i2 = 0 # keep track of which image we are displaying
|
||||||
|
|
||||||
self.double_buffer = self.matrix.CreateFrameCanvas()
|
self.double_buffer = self.matrix.CreateFrameCanvas()
|
||||||
update_process = Process(target = self.updateMultiple, args = ([options[(max(i1,i2)+1) % len(options)]],))
|
update_process = Process(target = self.updateMultiple, args = ([top[(i1+1) % len(top)]+ ' Prof', bottom[(i2+1) % len(bottom)]+ ' Prof' ],))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
|
|
||||||
image1 = self.openImage('./display_images/' + options[i1 % len(options)] +'.ppm')
|
image1 = self.openImage('./display_images/' + top[i1 % len(top)] +' Prof.ppm')
|
||||||
image1 = image1.convert('RGB')
|
image1 = image1.convert('RGB')
|
||||||
|
|
||||||
print(options[i2 % len(options)])
|
|
||||||
image2 = self.openImage('./display_images/' + options[i2 % len(options)] +'.ppm')
|
image2 = self.openImage('./display_images/' + bottom[i2 % len(bottom)] +' Prof.ppm')
|
||||||
image2 = image2.convert('RGB')
|
image2 = image2.convert('RGB')
|
||||||
|
|
||||||
|
|
||||||
settings1 = json.load(open(self.JSONs[options[0]]))
|
settings1 = json.load(open(self.JSONs[top[i1 % len(top)]]))
|
||||||
|
|
||||||
delay_t1 = self.set_delay(settings1['speed'])
|
delay_t1 = self.set_delay(settings1['speed'])
|
||||||
animation1 = settings1['animation'].lower()
|
animation1 = settings1['animation'].lower()
|
||||||
|
|
||||||
settings2 = json.load(open(self.JSONs[options[1]]))
|
settings2 = json.load(open(self.JSONs[bottom[i2 % len(bottom)] ]))
|
||||||
delay_t2 = self.set_delay(settings2['speed'])
|
delay_t2 = self.set_delay(settings2['speed'])
|
||||||
animation2 = settings2['animation'].lower()
|
animation2 = settings2['animation'].lower()
|
||||||
|
|
||||||
@ -491,15 +488,13 @@ class StockTicker():
|
|||||||
img_width2, img_height2 = image2.size
|
img_width2, img_height2 = image2.size
|
||||||
kill = False
|
kill = False
|
||||||
|
|
||||||
delay_t1 = 0.02
|
|
||||||
delay_t2 = 0.025
|
|
||||||
update_t1 = time.time()
|
update_t1 = time.time()
|
||||||
update_t2 = time.time()
|
update_t2 = time.time()
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
if offset_x1 < -(img_width1+1):
|
if offset_x1 < -(img_width1+1):
|
||||||
i1 = max(i1, i2) + 1
|
i1 += 1
|
||||||
settings1 = json.load(open(self.JSONs[options[i1 % len(options)]]))
|
settings1 = json.load(open(self.JSONs[top[i1 % len(top)]]))
|
||||||
|
|
||||||
delay_t1 = self.set_delay(settings1['speed'])
|
delay_t1 = self.set_delay(settings1['speed'])
|
||||||
animation1 = settings1['animation'].lower()
|
animation1 = settings1['animation'].lower()
|
||||||
@ -512,15 +507,15 @@ class StockTicker():
|
|||||||
offset_x1 = 0
|
offset_x1 = 0
|
||||||
|
|
||||||
update_process.join()
|
update_process.join()
|
||||||
update_process = Process(target = self.updateMultiple, args = ([options[i1 % len(options)]],))
|
update_process = Process(target = self.updateMultiple, args = ([top[i1 % len(top)]+ ' Prof'],))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
image1 = self.openImage('./display_images/' + options[i1 % len(options)] +'.ppm')
|
image1 = self.openImage('./display_images/' + top[i1 % len(top)] +' Prof.ppm')
|
||||||
image1 = image1.convert('RGB')
|
image1 = image1.convert('RGB')
|
||||||
img_width1, img_height1 = image1.size
|
img_width1, img_height1 = image1.size
|
||||||
|
|
||||||
if offset_x2 < -(img_width2+1):
|
if offset_x2 < -(img_width2+1):
|
||||||
i2 = max(i1, i2) + 1
|
i2 += 1
|
||||||
settings2 = json.load(open(self.JSONs[options[(i2) % len(options)]]))
|
settings2 = json.load(open(self.JSONs[bottom[(i2) % len(bottom)]]))
|
||||||
delay_t2 = self.set_delay(settings2['speed'])
|
delay_t2 = self.set_delay(settings2['speed'])
|
||||||
animation2 = settings2['animation'].lower()
|
animation2 = settings2['animation'].lower()
|
||||||
|
|
||||||
@ -533,9 +528,9 @@ class StockTicker():
|
|||||||
|
|
||||||
|
|
||||||
update_process.join()
|
update_process.join()
|
||||||
update_process = Process(target = self.updateMultiple, args = ([options[i2 % len(options)]],))
|
update_process = Process(target = self.updateMultiple, args = ([bottom[i2 % len(bottom)]+ ' Prof'],))
|
||||||
update_process.start()
|
update_process.start()
|
||||||
image2 = self.openImage('./display_images/' + options[i2 % len(options)] +'.ppm')
|
image2 = self.openImage('./display_images/' + bottom[i2 % len(bottom)] +' Prof.ppm')
|
||||||
image2 = image2.convert('RGB')
|
image2 = image2.convert('RGB')
|
||||||
img_width2, img_height2 = image2.size
|
img_width2, img_height2 = image2.size
|
||||||
|
|
||||||
@ -2440,10 +2435,10 @@ class StockTicker():
|
|||||||
#userSettings = ['crypto', 'stocks'] # these wil be read from csv, just for demo
|
#userSettings = ['crypto', 'stocks'] # 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
|
||||||
userSettings = json.load(open('csv/display_settings.json'))
|
userSettings = json.load(open('csv/display_settings.json'))
|
||||||
if len(userSettings)>0 and 'Prof' in userSettings[0] : #if professional display
|
if len(userSettings[1][0])>0 and len(userSettings[1][1])>0 and 'Professional'==userSettings[0] : #if professional display
|
||||||
self.scrollProfessionalAnimated(userSettings)
|
self.scrollProfessionalAnimated(userSettings[1])
|
||||||
elif len(userSettings)>0:
|
elif len(userSettings[1])>0 and 'Standard'==userSettings[0]:
|
||||||
self.scrollFunctionsAnimated(userSettings, animation = 'down')
|
self.scrollFunctionsAnimated(userSettings[1], animation = 'down')
|
||||||
|
|
||||||
elif msg == 'b':
|
elif msg == 'b':
|
||||||
userSettings = json.load(open('csv/display_settings.json'))
|
userSettings = json.load(open('csv/display_settings.json'))
|
||||||
|
@ -272,9 +272,20 @@
|
|||||||
id="display-format"
|
id="display-format"
|
||||||
class="display-features-list text-dark"
|
class="display-features-list text-dark"
|
||||||
>
|
>
|
||||||
{% for f in currently_displaying %}
|
|
||||||
<li>{{f}}</li>
|
{%if not professional%}
|
||||||
{% endfor%}
|
{% for f in currently_displaying %}
|
||||||
|
<li>{{f}}</li>
|
||||||
|
{% endfor%}
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
|
{%if professional%}
|
||||||
|
{% for f in currently_displaying[0] %}
|
||||||
|
<li>{{f}}</li>
|
||||||
|
{% endfor%}
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -347,6 +358,12 @@
|
|||||||
<ul
|
<ul
|
||||||
id="display-format-2"
|
id="display-format-2"
|
||||||
class="display-features-list text-dark"
|
class="display-features-list text-dark"
|
||||||
|
{%if professional%}
|
||||||
|
{% for f in currently_displaying[1] %}
|
||||||
|
<li> {{f}} </li>
|
||||||
|
{% endfor%}
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
></ul>
|
></ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -492,9 +509,7 @@
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
value=""
|
value=""
|
||||||
id="flexCheckChecked"
|
id="flexCheckChecked"
|
||||||
{%
|
{%if stocks_settings.percent%}
|
||||||
if
|
|
||||||
stocks_settings.percent%}
|
|
||||||
checked
|
checked
|
||||||
{%endif%}
|
{%endif%}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user