|
|
@@ -13,7 +13,6 @@ import pkce
|
|
|
import requests
|
|
|
from functools import wraps
|
|
|
import os
|
|
|
-from fontTools.ttLib import TTFont
|
|
|
|
|
|
ocb = Blueprint('web_panels', __name__)
|
|
|
|
|
|
@@ -142,7 +141,6 @@ def mgmt():
|
|
|
items=todolist_items,
|
|
|
todo_css=todo_css,
|
|
|
alerts_dict=alerts_dict,
|
|
|
- alert_font=alerts_dict['alert_font'],
|
|
|
activeTab=active_tab)
|
|
|
|
|
|
|
|
|
@@ -687,36 +685,6 @@ def ocb_alert(alert_type):
|
|
|
alert_name=alert_name)
|
|
|
|
|
|
|
|
|
-@ocb.route('/mgmt/fontupload', methods=['GET', 'POST'])
|
|
|
-def font_upload():
|
|
|
- alerts_dict = current_app.config['ALERTS']
|
|
|
- if request.method == 'POST':
|
|
|
- selected_font = request.form.get('font')
|
|
|
- uploaded_file = request.files.get('custom_font')
|
|
|
- current_app.logger.info(f"Selected font: {selected_font}")
|
|
|
- alerts_dict['alert_font'] = selected_font
|
|
|
- if save_alerts(alerts_dict): # Save new alerts.py
|
|
|
- current_app.logger.info(f'Added {selected_font} font to alerts.py.')
|
|
|
- if uploaded_file:
|
|
|
- uploaded_path = os.path.join(current_app.config['ALERTS_FOLDER'], uploaded_file.filename)
|
|
|
- uploaded_file.save(uploaded_path)
|
|
|
- try:
|
|
|
- font = TTFont(uploaded_path)
|
|
|
- name_table = font['name']
|
|
|
- for record in name_table.names:
|
|
|
- if record.nameID == 1: # The nameID for the font family
|
|
|
- selected_font = record.toStr()
|
|
|
- current_app.logger.info(f"Uploaded font: {selected_font}")
|
|
|
- alerts_dict['alert_font'] = selected_font
|
|
|
- if save_alerts(alerts_dict): # Save new alerts.py
|
|
|
- current_app.logger.info(f'Added {selected_font} font to alerts.py.')
|
|
|
- except Exception as gfnerror:
|
|
|
- current_app.logger.error(f"Error reading font file: {gfnerror}")
|
|
|
- return redirect(url_for('web_panels.mgmt', activeTab='alerts'))
|
|
|
-
|
|
|
- return redirect(url_for('web_panels.mgmt', activeTab='alerts'))
|
|
|
-
|
|
|
-
|
|
|
@ocb.route('/goals', methods=['GET']) # Route for goals overlay
|
|
|
def goals():
|
|
|
db = get_db()
|