fix:实现配置功能,实现园长一键签名功能
This commit is contained in:
@@ -5,21 +5,21 @@ from nicegui import ui, app, run, native
|
||||
from loguru import logger
|
||||
|
||||
from screeninfo import get_monitors
|
||||
|
||||
# 导入我们的模块
|
||||
import traceback
|
||||
from config.config import load_config
|
||||
# 导入我们的模块
|
||||
from ui.core.logger import setup_logger
|
||||
from utils.font_utils import install_fonts_from_directory
|
||||
from ui.views.home_page import create_page
|
||||
from ui.views.config_page import create_config_page
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
sys.stderr.reconfigure(encoding='utf-8')
|
||||
# 1. 初始化配置
|
||||
config = load_config("config.toml")
|
||||
|
||||
setup_logger()
|
||||
|
||||
|
||||
|
||||
|
||||
# === 关键修改:定义一个获取路径的通用函数 ===
|
||||
def get_path(relative_path):
|
||||
"""
|
||||
@@ -74,12 +74,14 @@ def calculate_window_size():
|
||||
static_dir = get_path(os.path.join("ui", "assets"))
|
||||
app.add_static_files('/assets', static_dir)
|
||||
|
||||
|
||||
# 3. 页面路由
|
||||
@ui.page('/')
|
||||
def index():
|
||||
def index_page():
|
||||
create_page()
|
||||
|
||||
@ui.page('/config')
|
||||
def config_page():
|
||||
create_config_page()
|
||||
|
||||
# 4. 启动时钩子
|
||||
async def startup_check():
|
||||
@@ -90,6 +92,7 @@ async def startup_check():
|
||||
logger.success("资源初始化完成")
|
||||
except Exception as e:
|
||||
logger.error(f"初始化失败: {e}")
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
app.on_startup(startup_check)
|
||||
|
||||
Reference in New Issue
Block a user