ogclient/src/kiosk/config.py

45 lines
1.2 KiB
Python

# Copyright (C) 2020-2025 Soleta Networks <info@soleta.eu>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
from PyQt6.QtGui import QColor
from src.utils.disk import *
from src.utils.net import *
import json
import os
config_data = {}
def update_config(new_config):
for k in new_config:
config_data[k] = new_config[k]
def get_boot_os_list():
return config_data.get('os_list', [])
def get_main_color_theme():
color_values = config_data.get('color_theme', [49, 69, 106])
return QColor(*color_values)
def side_panel_enabled():
return config_data.get('side_panel', True) and not is_busy_enabled()
def get_status():
return config_data.get('status', 'idle')
def set_status(value):
config_data['status'] = value
def is_busy_enabled():
return config_data.get('status', 'idle') == 'busy'
def get_log_path():
return f'/opt/opengnsys/log/{getifaddr(get_ethernet_interface())}.log'
def get_os_columns():
return config_data.get('os_columns', 2)