换位置
This commit is contained in:
@@ -29,7 +29,7 @@ from views.dialogs import (
|
||||
)
|
||||
|
||||
class DefaultKvTab(QWidget):
|
||||
"""默认配置编辑页面 - 编辑 .server_manager/config/default.kv"""
|
||||
"""默认配置编辑页面 - 编辑 .server_manager/config/default.config"""
|
||||
|
||||
def __init__(self, config: Config, console: OutputConsole):
|
||||
super().__init__()
|
||||
@@ -45,7 +45,7 @@ class DefaultKvTab(QWidget):
|
||||
layout.setSpacing(10)
|
||||
|
||||
# 标题和说明
|
||||
title = QLabel("默认配置管理 (.server_manager/config/default.kv)")
|
||||
title = QLabel("默认配置管理 (.server_manager/config/default.config)")
|
||||
title.setStyleSheet("font-size: 16px; font-weight: bold; color: #25c889;")
|
||||
layout.addWidget(title)
|
||||
|
||||
@@ -123,14 +123,15 @@ class DefaultKvTab(QWidget):
|
||||
layout.addLayout(btn_layout)
|
||||
|
||||
def load_default_kv(self):
|
||||
"""加载 default.kv 配置"""
|
||||
"""加载 default.config 配置"""
|
||||
server_root = self.config.get('workspace', 'server_root', default='')
|
||||
if not server_root:
|
||||
self.console.append_output("[警告] 请先配置服务器根目录\n")
|
||||
return
|
||||
|
||||
self.default_kv_path = get_server_manager_config_dir(server_root) / 'default.kv'
|
||||
if not self.default_kv_path.exists():
|
||||
load_path = find_existing_default_config_path(server_root)
|
||||
self.default_kv_path = get_default_config_path(server_root)
|
||||
if not load_path:
|
||||
self.console.append_output(f"[警告] 默认配置文件不存在: {self.default_kv_path}\n")
|
||||
return
|
||||
|
||||
@@ -139,7 +140,7 @@ class DefaultKvTab(QWidget):
|
||||
self.categories = {}
|
||||
current_category = "其他"
|
||||
|
||||
with open(self.default_kv_path, 'r', encoding='utf-8') as f:
|
||||
with open(load_path, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith('# ===') and line.endswith('==='):
|
||||
@@ -259,7 +260,7 @@ class DefaultKvTab(QWidget):
|
||||
self.console.append_output(f"[信息] 已删除配置项: {key}\n")
|
||||
|
||||
def save_default_kv(self):
|
||||
"""保存配置到 default.kv"""
|
||||
"""保存配置到 default.config"""
|
||||
if not self.default_kv_path:
|
||||
QMessageBox.warning(self, "警告", "请先加载配置文件")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user