fixed display bug when switching between professional and standard without saving in between
This commit is contained in:
@@ -89,7 +89,7 @@ def index():
|
|||||||
|
|
||||||
if not professional:
|
if not professional:
|
||||||
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
||||||
not_displaying = [f for f in all_features if f not in currently_displaying]
|
not_displaying = [f for f in all_features if f not in currently_displaying[0]]
|
||||||
|
|
||||||
elif professional:
|
elif professional:
|
||||||
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
|
||||||
@@ -143,7 +143,7 @@ def index():
|
|||||||
|
|
||||||
def save_displaying(input_settings):
|
def save_displaying(input_settings):
|
||||||
#print('save')
|
#print('save')
|
||||||
|
print('save_displaying_input:', input_settings)
|
||||||
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)',
|
||||||
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages']
|
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages']
|
||||||
|
|
||||||
@@ -155,14 +155,17 @@ def save_displaying(input_settings):
|
|||||||
display_settings = []
|
display_settings = []
|
||||||
|
|
||||||
if professional:
|
if professional:
|
||||||
|
input_settings = [[]]*2
|
||||||
input_settings[0] = [i for i in input_settings[0] if i in all_settings]
|
input_settings[0] = [i for i in input_settings[0] if i in all_settings]
|
||||||
input_settings[1] = [i for i in input_settings[1] if i in all_settings]
|
input_settings[1] = [i for i in input_settings[1] if i in all_settings]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
s = "Professional" if professional else "Standard"
|
s = "Professional" if professional else "Standard"
|
||||||
display_settings = [s] + [input_settings]
|
display_settings = [s] + [input_settings]
|
||||||
|
print(display_settings)
|
||||||
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)
|
||||||
|
|
||||||
|
@@ -877,14 +877,7 @@ function getListItems(list_el) {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggle professional
|
|
||||||
dispFormatButton.addEventListener("click", () => {
|
|
||||||
opt = getSelected(displayFormats);
|
|
||||||
fetch("/display_format", {
|
|
||||||
method: "PUT",
|
|
||||||
body: JSON.stringify(opt),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// gets which features are to be displayed
|
// gets which features are to be displayed
|
||||||
@@ -896,7 +889,7 @@ function getDisplaying(){
|
|||||||
|
|
||||||
let features = getListItems(list_el);
|
let features = getListItems(list_el);
|
||||||
|
|
||||||
return features;
|
return [features];
|
||||||
} else if (opt.includes("Professional")) {
|
} else if (opt.includes("Professional")) {
|
||||||
|
|
||||||
var top_list_el = document.getElementById("display-format");
|
var top_list_el = document.getElementById("display-format");
|
||||||
|
@@ -2699,8 +2699,8 @@ class StockTicker():
|
|||||||
userSettings = json.load(open('csv/display_settings.json'))
|
userSettings = json.load(open('csv/display_settings.json'))
|
||||||
if 'Professional'==userSettings[0] and len(userSettings[1][0])>0 and len(userSettings[1][1])>0: #if professional display
|
if 'Professional'==userSettings[0] and len(userSettings[1][0])>0 and len(userSettings[1][1])>0: #if professional display
|
||||||
self.scrollProfessionalAnimated(userSettings[1])
|
self.scrollProfessionalAnimated(userSettings[1])
|
||||||
elif len(userSettings[1])>0 and 'Standard'==userSettings[0]:
|
elif len(userSettings[1][0])>0 and 'Standard'==userSettings[0]:
|
||||||
self.scrollFunctionsAnimated(userSettings[1], animation = 'down')
|
self.scrollFunctionsAnimated(userSettings[1][0], animation = 'down')
|
||||||
|
|
||||||
elif msg == 'b':
|
elif msg == 'b':
|
||||||
userSettings = json.load(open('csv/display_settings.json'))
|
userSettings = json.load(open('csv/display_settings.json'))
|
||||||
|
@@ -150,7 +150,7 @@
|
|||||||
<select id="inputDisplayFormat" class="form-select">
|
<select id="inputDisplayFormat" class="form-select">
|
||||||
<option>Standard Scrolling</option>
|
<option>Standard Scrolling</option>
|
||||||
<option>Professional two rows</option>
|
<option>Professional two rows</option>
|
||||||
<option>Static display</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
@@ -212,17 +212,11 @@
|
|||||||
class="display-features-list text-dark"
|
class="display-features-list text-dark"
|
||||||
>
|
>
|
||||||
|
|
||||||
{%if not professional%}
|
|
||||||
{% for f in currently_displaying %}
|
|
||||||
<li>{{f}}</li>
|
|
||||||
{% endfor%}
|
|
||||||
{%endif%}
|
|
||||||
|
|
||||||
{%if professional%}
|
{% for f in currently_displaying[0] %}
|
||||||
{% for f in currently_displaying[0] %}
|
<li>{{f}}</li>
|
||||||
<li>{{f}}</li>
|
{% endfor%}
|
||||||
{% endfor%}
|
|
||||||
{%endif%}
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
Reference in New Issue
Block a user