update config

This commit is contained in:
2025-12-08 18:08:43 +08:00
parent 988947aa1a
commit 66768cb359
2 changed files with 10 additions and 4 deletions
+6
View File
@@ -1,6 +1,7 @@
import configparser import configparser
from pathlib import Path from pathlib import Path
import sys import sys
from typing import Any
miniQMTPath = r'D:\\Programs\\DTQMT\\userdata_mini' # miniQMT软件的安装路径 miniQMTPath = r'D:\\Programs\\DTQMT\\userdata_mini' # miniQMT软件的安装路径
# miniQMTPath = '' # miniQMTPath = ''
@@ -8,6 +9,8 @@ account_no:str = '99082560'
console_log = True console_log = True
log_level = "INFO" log_level = "INFO"
config : Any
def get_config_path() -> Path: def get_config_path() -> Path:
"""获取配置文件的正确路径(兼容开发环境和打包后的可执行文件)""" """获取配置文件的正确路径(兼容开发环境和打包后的可执行文件)"""
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
@@ -21,6 +24,9 @@ def get_config_path() -> Path:
return base_path / 'config.ini' return base_path / 'config.ini'
def get_config(section:str, key:str):
pass
def save_config(miniQmtPath:str, account_no:str): def save_config(miniQmtPath:str, account_no:str):
"""创建默认配置文件""" """创建默认配置文件"""
config = configparser.ConfigParser() config = configparser.ConfigParser()
+4 -4
View File
@@ -33,7 +33,7 @@ class MainEntry:
qmt_label = "QMT (已开启)" if self.qmt_enabled else "QMT (已关闭)" qmt_label = "QMT (已开启)" if self.qmt_enabled else "QMT (已关闭)"
return [ return [
{ {
"label": "交易大师", "label": "-- 交易大师 --",
"items": [ "items": [
{"label": "交易复盘", "action": "handler", "enabled": True}, {"label": "交易复盘", "action": "handler", "enabled": True},
{"label": "市场数据", "action": "handler", "enabled": True}, {"label": "市场数据", "action": "handler", "enabled": True},
@@ -41,7 +41,7 @@ class MainEntry:
], ],
}, },
{ {
"label": "策略交易", "label": "-- 策略交易 --",
"items": [ "items": [
{"label": "交易看板", "action": "handler", "enabled": True}, {"label": "交易看板", "action": "handler", "enabled": True},
{"label": "策略中心", "action": None, "enabled": False}, {"label": "策略中心", "action": None, "enabled": False},
@@ -49,13 +49,13 @@ class MainEntry:
], ],
}, },
{ {
"label": "实时数据", "label": "-- 实时数据 --",
"items": [ "items": [
{"label": qmt_label, "action": "marketDataSwitch", "enabled": True}, {"label": qmt_label, "action": "marketDataSwitch", "enabled": True},
], ],
}, },
{ {
"label": "系统", "label": "-- 系统 --",
"items": [ "items": [
{"label": "控制台", "action": "show_window", "enabled": True, "default": True}, {"label": "控制台", "action": "show_window", "enabled": True, "default": True},
{"label": "设置", "action": "marketDataSwitch", "enabled": True}, {"label": "设置", "action": "marketDataSwitch", "enabled": True},