GIF, screensaver bug fix and minor layout changes for messages
This commit is contained in:
parent
091920776a
commit
70189bdfdf
@ -212,8 +212,7 @@ def display_format():
|
||||
def save():
|
||||
print('save')
|
||||
global uploading
|
||||
while uploading:
|
||||
print('waiting for upload')
|
||||
|
||||
|
||||
data = str(request.data.decode('utf-8'))
|
||||
|
||||
@ -419,6 +418,9 @@ def screensaver():
|
||||
|
||||
elif "Sleep" in data:
|
||||
screensaver_p = DummyProcess()
|
||||
else: #default in case user hasnt set one yet
|
||||
screensaver_p = DummyProcess()
|
||||
|
||||
|
||||
displaying_screensaver = True
|
||||
return index()
|
||||
|
@ -653,7 +653,7 @@ class StockTicker():
|
||||
if kill: break
|
||||
i+=1
|
||||
|
||||
def textImage(self, text, font, r = 255, g = 255, b = 255, matrix_height = False, w_buff = 3, h_buff = 3, background = False):
|
||||
def textImage(self, text, font, r = 255, g = 255, b = 255, matrix_height = False, w_buff = 3, h_buff = 3, background = False, location = False):
|
||||
'''
|
||||
creates and returns a ppm image containing the text in the supplied font and colour
|
||||
'''
|
||||
@ -671,8 +671,10 @@ class StockTicker():
|
||||
fill = (br, bg, bb))
|
||||
#outline = (255, 255, 255),
|
||||
#width = 0) #use outline and width to add a border
|
||||
|
||||
d.text((0, 0), text, fill=(r, g, b), font=font)
|
||||
if location:
|
||||
d.text(location, text, fill=(r, g, b), font=font)
|
||||
else:
|
||||
d.text((0, 0), text, fill=(r, g, b), font=font)
|
||||
return img
|
||||
|
||||
|
||||
@ -701,17 +703,19 @@ class StockTicker():
|
||||
for ind, message in enumerate(all_settings['messages']):
|
||||
|
||||
font = ImageFont.load("./fonts/10x20.pil")
|
||||
|
||||
location = (0, 4)
|
||||
if message["size"] == 'Large':
|
||||
font = ImageFont.load("./fonts/texgyre-27.pil")
|
||||
location = (0, -2)
|
||||
elif message["size"] == 'Small':
|
||||
font = ImageFont.load("./fonts/6x13.pil")
|
||||
location = (0, 7)
|
||||
|
||||
|
||||
r,g,b = colours[message['text_colour']]
|
||||
|
||||
background = colours[message['background_colour']]
|
||||
img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 5, background = background)
|
||||
img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 5, background = background, location = location)
|
||||
|
||||
|
||||
if all_settings['title'] and ind == 0:
|
||||
@ -2483,7 +2487,9 @@ class StockTicker():
|
||||
|
||||
try:
|
||||
img = self.openImage(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), image))
|
||||
print(img)
|
||||
img.thumbnail((99999, 32))
|
||||
print(img)
|
||||
if all_settings['title'] and ind == 0:
|
||||
title_img = self.openImage('feature_titles/images.png')
|
||||
imgs.append(self.stitchImage([title_img, img]))
|
||||
@ -2523,16 +2529,20 @@ class StockTicker():
|
||||
title_img = self.openImage('feature_titles/gifs.png')
|
||||
|
||||
for i, frame in enumerate(ImageSequence.Iterator(GIF)):
|
||||
|
||||
frame.thumbnail((99999, 32))
|
||||
frame = frame.convert('RGB')
|
||||
frame.thumbnail((128, 32))
|
||||
|
||||
f = self.stitchImage([title_img, frame])
|
||||
frames.append(f)
|
||||
|
||||
else:
|
||||
|
||||
for i, frame in enumerate(ImageSequence.Iterator(GIF)):
|
||||
|
||||
frame.thumbnail((99999, 32))
|
||||
|
||||
frame = frame.convert('RGB')
|
||||
frame.thumbnail((128, 32))
|
||||
|
||||
#frame = frame.resize((99999, 32))
|
||||
f = self.stitchImage([frame])
|
||||
frames.append(f)
|
||||
|
||||
@ -2710,7 +2720,9 @@ if __name__ == '__main__':
|
||||
#stock_ticker.process_msg('G')
|
||||
#stock_ticker.process_msg('f')
|
||||
#stock_ticker.process_msg('W')
|
||||
#stock_ticker.process_msg('A')
|
||||
stock_ticker.process_msg('A')
|
||||
|
||||
|
||||
|
||||
while True:
|
||||
msg = getInput()
|
||||
|
569
templates/app.js
569
templates/app.js
@ -1,569 +0,0 @@
|
||||
|
||||
|
||||
var availableFeatures = document.querySelectorAll("#available-features li");
|
||||
var displayFormat = document.querySelector("#display-format");
|
||||
var featureToDisplay = document.querySelector("#feature-to-display");
|
||||
var displayToFeature = document.querySelector("#display-to-feature");
|
||||
var displayToFormat = document.querySelectorAll("#display-format li");
|
||||
var availableToDisplay = document.querySelector("#available-features");
|
||||
var displayincreaseBtn = document.getElementById("display-increase-btn");
|
||||
var displayDecreaseBtn = document.getElementById("display-decrease-btn");
|
||||
|
||||
|
||||
|
||||
|
||||
// features lists
|
||||
var stocksFeatures = document.querySelectorAll("#stocks-features li");
|
||||
var cryptoFeatures = document.querySelectorAll("#crypto-features li");
|
||||
var forexFeatures = document.querySelectorAll("#forex-features li");
|
||||
var currentWeatherFeatures = document.querySelectorAll(
|
||||
"#current-weather-features li"
|
||||
);
|
||||
var dailyForecastFeatures = document.querySelectorAll(
|
||||
"#daily-forecast-features li"
|
||||
);
|
||||
var newsFeatures = document.querySelectorAll("#news-features li");
|
||||
var upcomingGamesFeatures = document.querySelectorAll(
|
||||
"#upcoming-games-features li"
|
||||
);
|
||||
var pastGamesFeatures = document.querySelectorAll("#past-games-features li");
|
||||
var liveGamesFeatures = document.querySelectorAll("#live-games-features li");
|
||||
var teamStatsFeatures = document.querySelectorAll("#team-stats-features li");
|
||||
var imagesFeatures = document.querySelectorAll("#images-features li");
|
||||
var gifsFeatures = document.querySelectorAll("#gifs-features li");
|
||||
var messagesFeatures = document.querySelectorAll("#messages-features li");
|
||||
|
||||
var allFeaturesList = [
|
||||
stocksFeatures,
|
||||
cryptoFeatures,
|
||||
forexFeatures,
|
||||
currentWeatherFeatures,
|
||||
dailyForecastFeatures,
|
||||
newsFeatures,
|
||||
upcomingGamesFeatures,
|
||||
pastGamesFeatures,
|
||||
liveGamesFeatures,
|
||||
teamStatsFeatures,
|
||||
imagesFeatures,
|
||||
gifsFeatures,
|
||||
messagesFeatures,
|
||||
];
|
||||
|
||||
// features remove buttons
|
||||
var stocksRemoveBtn = document.getElementById("stocks-remove-btn");
|
||||
var cryptoRemoveBtn = document.getElementById("crypto-remove-btn");
|
||||
var forexRemoveBtn = document.getElementById("forex-remove-btn");
|
||||
var currentWeatherRemoveBtn = document.getElementById(
|
||||
"current-weather-remove-btn"
|
||||
);
|
||||
var dailyForecastRemoveBtn = document.getElementById(
|
||||
"daily-forecast-remove-btn"
|
||||
);
|
||||
var newsRemoveBtn = document.getElementById("news-remove-btn");
|
||||
var upcomingGamesRemoveBtn = document.getElementById(
|
||||
"upcoming-games-remove-btn"
|
||||
);
|
||||
var pastGamesRemoveBtn = document.getElementById("past-games-remove-btn");
|
||||
var liveGamesRemoveBtn = document.getElementById("live-games-remove-btn");
|
||||
var teamStatsRemoveBtn = document.getElementById("team-stats-remove-btn");
|
||||
var imagesRemoveBtn = document.getElementById("images-remove-btn");
|
||||
var gifsRemoveBtn = document.getElementById("gifs-remove-btn");
|
||||
var messagesRemoveBtn = document.getElementById("messages-remove-btn");
|
||||
|
||||
var allFeaturesRemoveBtns = [
|
||||
stocksRemoveBtn,
|
||||
cryptoRemoveBtn,
|
||||
forexRemoveBtn,
|
||||
currentWeatherRemoveBtn,
|
||||
dailyForecastRemoveBtn,
|
||||
newsRemoveBtn,
|
||||
upcomingGamesRemoveBtn,
|
||||
pastGamesRemoveBtn,
|
||||
liveGamesRemoveBtn,
|
||||
teamStatsRemoveBtn,
|
||||
imagesRemoveBtn,
|
||||
gifsRemoveBtn,
|
||||
messagesRemoveBtn,
|
||||
];
|
||||
// features increase buttons
|
||||
var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
|
||||
var cryptoincreaseBtn = document.getElementById("crypto-increase-btn");
|
||||
var forexincreaseBtn = document.getElementById("forex-increase-btn");
|
||||
var currentWeatherincreaseBtn = document.getElementById(
|
||||
"current-weather-increase-btn"
|
||||
);
|
||||
var dailyForecastincreaseBtn = document.getElementById(
|
||||
"daily-forecast-increase-btn"
|
||||
);
|
||||
var newsincreaseBtn = document.getElementById("news-increase-btn");
|
||||
var upcomingGamesincreaseBtn = document.getElementById(
|
||||
"upcoming-games-increase-btn"
|
||||
);
|
||||
var pastGamesincreaseBtn = document.getElementById("past-games-increase-btn");
|
||||
var liveGamesincreaseBtn = document.getElementById("live-games-increase-btn");
|
||||
var teamStatsincreaseBtn = document.getElementById("team-stats-increase-btn");
|
||||
var imagesincreaseBtn = document.getElementById("images-increase-btn");
|
||||
var gifsincreaseBtn = document.getElementById("gifs-increase-btn");
|
||||
var messagesincreaseBtn = document.getElementById("messages-increase-btn");
|
||||
|
||||
var allFeaturesIncreaseBtns = [
|
||||
stocksincreaseBtn,
|
||||
cryptoincreaseBtn,
|
||||
forexincreaseBtn,
|
||||
currentWeatherincreaseBtn,
|
||||
dailyForecastincreaseBtn,
|
||||
newsincreaseBtn,
|
||||
upcomingGamesincreaseBtn,
|
||||
pastGamesincreaseBtn,
|
||||
liveGamesincreaseBtn,
|
||||
teamStatsincreaseBtn,
|
||||
imagesincreaseBtn,
|
||||
gifsincreaseBtn,
|
||||
messagesincreaseBtn,
|
||||
];
|
||||
|
||||
// features decrease buttons
|
||||
var stocksDecreaseBtn = document.getElementById("stocks-decrease-btn");
|
||||
var cryptoDecreaseBtn = document.getElementById("crypto-decrease-btn");
|
||||
var forexDecreaseBtn = document.getElementById("forex-decrease-btn");
|
||||
var currentWeatherDecreaseBtn = document.getElementById(
|
||||
"current-weather-decrease-btn"
|
||||
);
|
||||
var dailyForecastDecreaseBtn = document.getElementById(
|
||||
"daily-forecast-decrease-btn"
|
||||
);
|
||||
var newsDecreaseBtn = document.getElementById("news-decrease-btn");
|
||||
var upcomingGamesDecreaseBtn = document.getElementById(
|
||||
"upcoming-games-decrease-btn"
|
||||
);
|
||||
var pastGamesDecreaseBtn = document.getElementById("past-games-decrease-btn");
|
||||
var liveGamesDecreaseBtn = document.getElementById("live-games-decrease-btn");
|
||||
var teamStatsDecreaseBtn = document.getElementById("team-stats-decrease-btn");
|
||||
var imagesDecreaseBtn = document.getElementById("images-decrease-btn");
|
||||
var gifsDecreaseBtn = document.getElementById("gifs-decrease-btn");
|
||||
var messagesDecreaseBtn = document.getElementById("messages-decrease-btn");
|
||||
|
||||
var allFeaturesDecreaseBtns = [
|
||||
stocksDecreaseBtn,
|
||||
cryptoDecreaseBtn,
|
||||
forexDecreaseBtn,
|
||||
currentWeatherDecreaseBtn,
|
||||
dailyForecastDecreaseBtn,
|
||||
newsDecreaseBtn,
|
||||
upcomingGamesDecreaseBtn,
|
||||
pastGamesDecreaseBtn,
|
||||
liveGamesDecreaseBtn,
|
||||
teamStatsDecreaseBtn,
|
||||
imagesDecreaseBtn,
|
||||
gifsDecreaseBtn,
|
||||
messagesDecreaseBtn,
|
||||
];
|
||||
|
||||
const changeVarValue = () => {
|
||||
stocksFeatures = document.querySelectorAll("#stocks-features li");
|
||||
cryptoFeatures = document.querySelectorAll("#crypto-features li");
|
||||
forexFeatures = document.querySelectorAll("#forex-features li");
|
||||
currentWeatherFeatures = document.querySelectorAll(
|
||||
"#current-weather-features li"
|
||||
);
|
||||
dailyForecastFeatures = document.querySelectorAll(
|
||||
"#daily-forecast-features li"
|
||||
);
|
||||
newsFeatures = document.querySelectorAll("#news-features li");
|
||||
upcomingGamesFeatures = document.querySelectorAll(
|
||||
"#upcoming-games-features li"
|
||||
);
|
||||
pastGamesFeatures = document.querySelectorAll("#past-games-features li");
|
||||
liveGamesFeatures = document.querySelectorAll("#live-games-features li");
|
||||
teamStatsFeatures = document.querySelectorAll("#team-stats-features li");
|
||||
imagesFeatures = document.querySelectorAll("#images-features li");
|
||||
gifsFeatures = document.querySelectorAll("#gifs-features li");
|
||||
messagesFeatures = document.querySelectorAll("#messages-features li");
|
||||
|
||||
allFeaturesList = [
|
||||
stocksFeatures,
|
||||
cryptoFeatures,
|
||||
forexFeatures,
|
||||
currentWeatherFeatures,
|
||||
dailyForecastFeatures,
|
||||
newsFeatures,
|
||||
upcomingGamesFeatures,
|
||||
pastGamesFeatures,
|
||||
liveGamesFeatures,
|
||||
teamStatsFeatures,
|
||||
imagesFeatures,
|
||||
gifsFeatures,
|
||||
messagesFeatures,
|
||||
];
|
||||
};
|
||||
|
||||
const addEventOnList = () => {
|
||||
// for available feature
|
||||
for (let i = 0; i < availableFeatures.length; i++) {
|
||||
const availableFeature = availableFeatures[i];
|
||||
availableFeature.addEventListener("click", () => {
|
||||
for (let i = 0; i < availableFeatures.length; i++) {
|
||||
availableFeatures[i].setAttribute("class", "");
|
||||
}
|
||||
if (availableFeature.getAttribute("class") == "active") {
|
||||
availableFeature.setAttribute("class", "");
|
||||
} else {
|
||||
availableFeature.setAttribute("class", "active");
|
||||
}
|
||||
});
|
||||
}
|
||||
// for display format
|
||||
for (let i = 0; i < displayToFormat.length; i++) {
|
||||
const display_format = displayToFormat[i];
|
||||
display_format.addEventListener("click", () => {
|
||||
for (let i = 0; i < displayToFormat.length; i++) {
|
||||
displayToFormat[i].setAttribute("class", "");
|
||||
}
|
||||
if (display_format.getAttribute("class") == "active") {
|
||||
display_format.setAttribute("class", "");
|
||||
} else {
|
||||
display_format.setAttribute("class", "active");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const addEventonBtns = () => {
|
||||
featureToDisplay.addEventListener("click", () => {
|
||||
for (let i = 0; i < availableFeatures.length; i++) {
|
||||
const availableFeature = availableFeatures[i];
|
||||
if (availableFeature.getAttribute("class") == "active") {
|
||||
availableFeature.remove();
|
||||
availableFeature.setAttribute("class", "");
|
||||
displayFormat.appendChild(availableFeature);
|
||||
availableFeatures = document.querySelectorAll("#available-features li");
|
||||
displayToFormat = document.querySelectorAll("#display-format li");
|
||||
addEventOnList();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
displayToFeature.addEventListener("click", () => {
|
||||
for (let i = 0; i < displayToFormat.length; i++) {
|
||||
const availableFormat = displayToFormat[i];
|
||||
if (availableFormat.getAttribute("class") == "active") {
|
||||
availableFormat.remove();
|
||||
availableFormat.setAttribute("class", "");
|
||||
availableToDisplay.appendChild(availableFormat);
|
||||
availableFeatures = document.querySelectorAll("#available-features li");
|
||||
displayToFormat = document.querySelectorAll("#display-format li");
|
||||
addEventOnList();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
addEventOnList();
|
||||
addEventonBtns();
|
||||
|
||||
const addEventOnFeaturesList = () => {
|
||||
allFeaturesList.map((value) => {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const availableFeature = value[i];
|
||||
availableFeature.addEventListener("click", () => {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
value[i].setAttribute("class", "");
|
||||
}
|
||||
if (availableFeature.getAttribute("class") == "active") {
|
||||
availableFeature.setAttribute("class", "");
|
||||
} else {
|
||||
availableFeature.setAttribute("class", "active");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
addEventOnFeaturesList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// display increase function
|
||||
displayincreaseBtn.addEventListener("click", () => {
|
||||
console.log('hello');
|
||||
for (let i = 0; i < displayToFormat.length; i++) {
|
||||
var displayItem = displayToFormat[i];
|
||||
|
||||
if (displayItem.getAttribute("class") == "active") {
|
||||
var prevElement = displayItem.previousElementSibling;
|
||||
var currentText = displayItem.innerText;
|
||||
|
||||
displayItem.innerText = prevElement.innerText;
|
||||
prevElement.innerText = currentText;
|
||||
prevElement.setAttribute("class", "active");
|
||||
displayItem.setAttribute("class", "");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// display decrease function
|
||||
displayDecreaseBtn.addEventListener("click", () => {
|
||||
for (let i = 0; i < displayToFormat.length; i++) {
|
||||
var displayItem = displayToFormat[i];
|
||||
|
||||
if (displayItem.getAttribute("class") == "active") {
|
||||
var nextElement = displayItem.nextElementSibling;
|
||||
var currentText = displayItem.innerText;
|
||||
|
||||
displayItem.innerText = nextElement.innerText;
|
||||
nextElement.innerText = currentText;
|
||||
nextElement.setAttribute("class", "active");
|
||||
displayItem.setAttribute("class", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// feature remove function
|
||||
allFeaturesRemoveBtns.map((value, index) => {
|
||||
value.addEventListener("click", () => {
|
||||
for (let i = 0; i < allFeaturesList[index].length; i++) {
|
||||
var item = allFeaturesList[index][i];
|
||||
if (item.getAttribute("class") == "active") {
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// feature increase function
|
||||
allFeaturesIncreaseBtns.map((value, index) => {
|
||||
value.addEventListener("click", () => {
|
||||
for (let i = 0; i < allFeaturesList[index].length; i++) {
|
||||
var item = allFeaturesList[index][i];
|
||||
|
||||
if (item.getAttribute("class") == "active") {
|
||||
var prevElement = item.previousElementSibling;
|
||||
var currentText = item.innerText;
|
||||
item.innerText = prevElement.innerText;
|
||||
prevElement.innerText = currentText;
|
||||
prevElement.setAttribute("class", "active");
|
||||
item.setAttribute("class", "");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// feature decrease function
|
||||
allFeaturesDecreaseBtns.map((value, index) => {
|
||||
value.addEventListener("click", () => {
|
||||
for (let i = 0; i < allFeaturesList[index].length; i++) {
|
||||
var item = allFeaturesList[index][i];
|
||||
|
||||
if (item.getAttribute("class") == "active") {
|
||||
var nextElement = item.nextElementSibling;
|
||||
var currentText = item.innerText;
|
||||
|
||||
item.innerText = nextElement.innerText;
|
||||
nextElement.innerText = currentText;
|
||||
nextElement.setAttribute("class", "active");
|
||||
item.setAttribute("class", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// all features
|
||||
var stocks = document.getElementById("stocks-features");
|
||||
var crypto1 = document.getElementById("crypto-features");
|
||||
var forex = document.getElementById("forex-features");
|
||||
var currentWeather = document.getElementById("current-weather-features");
|
||||
var dailyForecast = document.getElementById("daily-forecast-features");
|
||||
var news = document.getElementById("news-features");
|
||||
var upcomingGames = document.getElementById("upcoming-games-features");
|
||||
var pastGames = document.getElementById("past-games-features");
|
||||
var liveGames = document.getElementById("live-games-features");
|
||||
var teamStats = document.getElementById("team-stats-features");
|
||||
var images = document.getElementById("images-features");
|
||||
var gifs = document.getElementById("gifs-features");
|
||||
var messages = document.getElementById("messages-features");
|
||||
|
||||
var allFeatures = [
|
||||
stocks,
|
||||
crypto1,
|
||||
forex,
|
||||
currentWeather,
|
||||
dailyForecast,
|
||||
news,
|
||||
upcomingGames,
|
||||
pastGames,
|
||||
liveGames,
|
||||
teamStats,
|
||||
images,
|
||||
gifs,
|
||||
messages,
|
||||
];
|
||||
|
||||
// features select box
|
||||
var newsSelect = document.getElementById("inputTransition63");
|
||||
var upcomingGamesSelect = document.getElementById("inputTransition73");
|
||||
var pastGamesSelect = document.getElementById("inputTransition83");
|
||||
var liveGamesSelect = document.getElementById("inputTransition93");
|
||||
var teamStatsSelect = document.getElementById("inputTransition103");
|
||||
var allFeaturesSelectBox = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
newsSelect,
|
||||
upcomingGamesSelect,
|
||||
pastGamesSelect,
|
||||
liveGamesSelect,
|
||||
teamStatsSelect,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
];
|
||||
|
||||
// features select add buttons
|
||||
var newsAddBtn = document.getElementById("inputTransitionBtn63");
|
||||
var upcomingGamesAddBtn = document.getElementById("inputTransitionBtn73");
|
||||
var pastGamesAddBtn = document.getElementById("inputTransitionBtn83");
|
||||
var liveGamesAddBtn = document.getElementById("inputTransitionBtn93");
|
||||
var teamStatsAddBtn = document.getElementById("inputTransitionBtn103");
|
||||
var allFeaturesSelectAddBtn = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
newsAddBtn,
|
||||
upcomingGamesAddBtn,
|
||||
pastGamesAddBtn,
|
||||
liveGamesAddBtn,
|
||||
teamStatsAddBtn,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
];
|
||||
|
||||
allFeaturesSelectAddBtn.map((value, index) => {
|
||||
if (value != null) {
|
||||
value.addEventListener("click", () => {
|
||||
var tag = document.createElement("li");
|
||||
tag.innerHTML = allFeaturesSelectBox[index].value;
|
||||
allFeatures[index].appendChild(tag);
|
||||
changeVarValue();
|
||||
addEventOnFeaturesList();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// features input file
|
||||
var imagesFile = document.getElementById("inputText11");
|
||||
var gifsFile = document.getElementById("inputText1112");
|
||||
|
||||
var allFeaturesFile = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
imagesFile,
|
||||
gifsFile,
|
||||
null,
|
||||
];
|
||||
// features file add button
|
||||
var imagesFileAddBtn = document.getElementById("inputTextBtn11");
|
||||
var gifsFileAddBtn = document.getElementById("inputTextBtn1112");
|
||||
|
||||
var allFeaturesFileAddBtn = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
imagesFileAddBtn,
|
||||
gifsFileAddBtn,
|
||||
null,
|
||||
];
|
||||
|
||||
allFeaturesFileAddBtn.map((value, index) => {
|
||||
if (value !== null) {
|
||||
value.addEventListener("click", () => {
|
||||
var tag = document.createElement("li");
|
||||
tag.innerHTML = allFeaturesFile[index].files[0].name;
|
||||
allFeatures[index].appendChild(tag);
|
||||
changeVarValue();
|
||||
addEventOnFeaturesList();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// features input text
|
||||
var stocksText = document.getElementById("inputText3");
|
||||
var cryptoText = document.getElementById("inputText4");
|
||||
var forexText = document.getElementById("inputText5");
|
||||
var currentWeatherText = document.getElementById("inputText6");
|
||||
var dailyForecastText = document.getElementById("inputText7");
|
||||
var messagesText = document.getElementById("inputText13");
|
||||
|
||||
var allFeaturesText = [
|
||||
stocksText,
|
||||
cryptoText,
|
||||
forexText,
|
||||
currentWeatherText,
|
||||
dailyForecastText,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messagesText,
|
||||
];
|
||||
|
||||
// features text add button
|
||||
var stocksTextAddBtn = document.getElementById("inputTextBtn3");
|
||||
var cryptoTextAddBtn = document.getElementById("inputTextBtn4");
|
||||
var forexTextAddBtn = document.getElementById("inputTextBtn5");
|
||||
var currentWeatherTextAddBtn = document.getElementById("inputTextBtn6");
|
||||
var dailyForecastTextAddBtn = document.getElementById("inputTextBtn7");
|
||||
var messagesTextAddBtn = document.getElementById("inputTextBtn13");
|
||||
|
||||
var allFeaturesTextAddBtn = [
|
||||
stocksTextAddBtn,
|
||||
cryptoTextAddBtn,
|
||||
forexTextAddBtn,
|
||||
currentWeatherTextAddBtn,
|
||||
dailyForecastTextAddBtn,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messagesTextAddBtn,
|
||||
];
|
||||
|
||||
allFeaturesTextAddBtn.map((value, index) => {
|
||||
if (value !== null) {
|
||||
value.addEventListener("click", () => {
|
||||
var tag = document.createElement("li");
|
||||
tag.innerHTML = allFeaturesText[index].value;
|
||||
allFeatures[index].appendChild(tag);
|
||||
changeVarValue();
|
||||
addEventOnFeaturesList();
|
||||
});
|
||||
}
|
||||
});
|
@ -1,99 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="stylesheet" href='/static/style.css' />
|
||||
<title>{{ title }}</title>
|
||||
<style>p {color:gray}</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>Stock Ticker Control Panel</h2>
|
||||
|
||||
<br><br>
|
||||
<form action="/matrix" method="POST">
|
||||
<input type="submit" name="Run Stocks" value="Run Stocks" style="height:50px" >
|
||||
<input type="submit" name="Run Crypto" value="Run Crypto" style="height:50px" >
|
||||
<input type="submit" name="Run Forex" value="Run Forex" style="height:50px" >
|
||||
<input type="submit" name="Run News" value="Run News" style="height:50px" >
|
||||
<input type="submit" name="Run Weather" value="Run Weather" style="height:50px" >
|
||||
<input type="submit" name="Run Daily Weather" value="Run Daily Weather" style="height:50px" >
|
||||
<input type="submit" name="Past NHL" value="Past NHL" style="height:50px" >
|
||||
<input type="submit" name="Future NHL" value="Future NHL" style="height:50px" >
|
||||
<input type="submit" name="Live NHL" value="Live NHL" style="height:50px" >
|
||||
<input type="submit" name="Premier league table" value="Premier league table" style="height:50px" >
|
||||
<input type="submit" name="Professional" value="Professional" style="height:50px" >
|
||||
<input type="submit" name="All" value="All" style="height:50px" >
|
||||
<input type="submit" name="Multiple" value="Multiple" style="height:50px" >
|
||||
<input type="submit" name="Stop Display" value="Stop Display"style="height:50px">
|
||||
<input type="submit" name="Shutdown the pi" value="Shutdown the pi"style="height:50px">
|
||||
</form>
|
||||
<br><br>
|
||||
<br><br>
|
||||
|
||||
<p>Set the speed the image scrolls across the screen (s, m of f for slow, medium or fast)</p>
|
||||
<form action="/Speed" method="POST">
|
||||
<input name="text" placeholder="m"style="height:24px">
|
||||
<input type="submit" value="Speed"style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Set the brightness, an integer between 1 and 10, higher is brighter</p>
|
||||
<form action="/Brightness" method="POST">
|
||||
<input name="text" placeholder="10"style="height:24px">
|
||||
<input type="submit" value="Brightness"style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Display scrolling text. Enter the message followed by the rgb values seperated by commas. e.g. hello world!,255,255,0</p>
|
||||
<form action="/DisplayText" method="POST">
|
||||
<input name="text" placeholder="hello world!,255,255,0"style="height:24px">
|
||||
<input type="submit" value="Display"style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Set news search settings. keyword,category,country e.g. bitcoin,business,us </p>
|
||||
<form action="/SetNews" method="POST">
|
||||
<input name="text" placeholder="bitcoin,business,us"style="height:24px">
|
||||
<input type="submit" value="Set"style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Set weather location, enter city name e.g. London </p>
|
||||
<form action="/SetWeather" method="POST">
|
||||
<input name="text" placeholder="London"style="height:24px">
|
||||
<input type="submit" value="Set"style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Display a gif</p>
|
||||
<form action="/DisplayGIF" method="POST" enctype=multipart/form-data>
|
||||
<p><input type=file name=file style="height:30px">
|
||||
<input type=submit value=Upload style="height:30px">
|
||||
</form>
|
||||
|
||||
<p>Display an image</p>
|
||||
<form action="/DisplayImage" method="POST" enctype=multipart/form-data>
|
||||
<p><input type=file name=file style="height:30px">
|
||||
<input type=submit value=Upload style="height:30px">
|
||||
</form>
|
||||
|
||||
|
||||
<br><br>
|
||||
<h3>Tickers to display</h3>
|
||||
<p>To change the tickers displayed please upload a CSV (comma separated value) file with 11 tickers on each row e.g</p>
|
||||
<p>MSFT,NFLX,GOOG,TSLA,AAPL,INTC,TXN,HPQ,HOG,LUV,WMT</p>
|
||||
<p>WMT,LUV,HOG,HPQ,TXN,INTC,AAPL,TSLA,GOOG,NFLX,MSFT</p>
|
||||
<form action="/Ticker" method="POST" enctype=multipart/form-data>
|
||||
<p><input type=file name=file style="height:30px">
|
||||
<input type=submit value=Upload style="height:30px">
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
<h3>Logos</h3>
|
||||
<p>Upload logo images (e.g "TICKER.png") or change the default images here</p>
|
||||
<p>1) logos must be 32px in height and can be any width</p>
|
||||
<p>2) "blank.png" is the space between stocks, default of 10x32px</p>
|
||||
<p>3) "default.png" is the default logo to be used if no logo can be found</p>
|
||||
<p>4) arrows (up/down.png) must be 16x14px</p>
|
||||
<form action="/AddLogo" method="POST" enctype=multipart/form-data>
|
||||
<p><input type=file name=file style="height:30px">
|
||||
<input type=submit value=Upload style="height:30px">
|
||||
</form>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user