格式统一
This commit is contained in:
@ -92,6 +92,14 @@ class ConfigManager(QObject):
|
||||
)
|
||||
return
|
||||
|
||||
# ★ 验证 JSON 结构:必须是 dict 类型
|
||||
if not isinstance(config, dict):
|
||||
QMessageBox.critical(
|
||||
self.parent(), "配置格式错误",
|
||||
f"配置文件格式不正确(期望 JSON 对象,实际为 {type(config).__name__})。\n请确认选择了正确的配置文件。"
|
||||
)
|
||||
return
|
||||
|
||||
# 回填已加载面板
|
||||
loaded_count = 0
|
||||
for step_id, panel in self._panel_factory.get_loaded_panels().items():
|
||||
@ -99,8 +107,11 @@ class ConfigManager(QObject):
|
||||
try:
|
||||
panel.set_config(config[step_id])
|
||||
loaded_count += 1
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
global_event_bus.publish('LogMessage', {
|
||||
'message': f'[警告] 面板 {step_id} 加载配置失败: {e}',
|
||||
'level': 'warning',
|
||||
})
|
||||
|
||||
global_event_bus.publish('LogMessage', {
|
||||
'message': f'已加载配置: {file_path}(回填 {loaded_count} 个面板)',
|
||||
@ -156,6 +167,10 @@ class ConfigManager(QObject):
|
||||
if hasattr(panel, 'get_config'):
|
||||
try:
|
||||
config[step_id] = panel.get_config()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
config[step_id] = {}
|
||||
global_event_bus.publish('LogMessage', {
|
||||
'message': f'[警告] 面板 {step_id} 获取配置失败: {e}',
|
||||
'level': 'warning',
|
||||
})
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user