1919import matplotlib .style as style
2020from matplotlib .backends .backend_qtagg import FigureCanvasQTAgg as FigureCanvas
2121from matplotlib .figure import Figure
22-
23- from PySide6 .QtCore import QThread , QTimer , Signal , Qt
22+ from PySide6 .QtCore import Qt , QThread , QTimer , Signal
2423from PySide6 .QtGui import QColor , QFont , QIcon , QPixmap
2524from PySide6 .QtWidgets import (QApplication , QCheckBox , QDialog ,
2625 QDoubleSpinBox , QGridLayout , QGroupBox ,
2726 QHBoxLayout , QInputDialog , QLabel , QLineEdit ,
2827 QMainWindow , QMenu , QMessageBox , QPushButton ,
29- QStyle , QSystemTrayIcon , QTabWidget ,
30- QTableWidgetItem , QVBoxLayout , QWidget )
28+ QStyle , QSystemTrayIcon , QTableWidgetItem ,
29+ QTabWidget , QVBoxLayout , QWidget )
3130
3231from config import config
3332from models .database import DatabaseManager
3433from services .data_fetcher import FundDataFetcher
3534from services .notification import NotificationManager
36- from ui .widgets .table_widget import FundTableWidget
37- from ui .widgets .search_widget import FundSearchWidget
38- from ui .widgets .portfolio_dashboard import PortfolioDashboard
3935from ui .widgets .investment_calculator_dialog import InvestmentCalculatorDialog
36+ from ui .widgets .portfolio_dashboard import PortfolioDashboard
37+ from ui .widgets .search_widget import FundSearchWidget
38+ from ui .widgets .table_widget import FundTableWidget
4039from utils .logger import logger
4140
4241matplotlib .use ('Agg' )
@@ -1737,8 +1736,8 @@ def load_history_data(self):
17371736
17381737 def generate_mock_data (self ):
17391738 """生成模拟历史数据"""
1740- from datetime import timedelta
17411739 import random
1740+ from datetime import timedelta
17421741
17431742 dates = []
17441743 values = []
@@ -1812,7 +1811,7 @@ class NotificationSettingsDialog(QDialog):
18121811 def __init__ (self , parent = None ):
18131812 super ().__init__ (parent )
18141813 self .setWindowTitle ("通知设置" )
1815- self .setFixedSize (600 , 500 )
1814+ self .setFixedSize (600 , 560 )
18161815 self .setStyleSheet ("""
18171816 QDialog {
18181817 background: white;
@@ -1860,6 +1859,14 @@ def init_ui(self):
18601859 webhook_layout .addWidget (self .dingtalk_webhook )
18611860 dingtalk_layout .addLayout (webhook_layout )
18621861
1862+ secret_layout = QHBoxLayout ()
1863+ secret_layout .addWidget (QLabel ("加签密钥:" ))
1864+ self .dingtalk_secret = QLineEdit ()
1865+ self .dingtalk_secret .setPlaceholderText ("SEC开头的密钥(选填,机器人安全设置中的加签密钥)" )
1866+ self .dingtalk_secret .setEchoMode (QLineEdit .Password )
1867+ secret_layout .addWidget (self .dingtalk_secret )
1868+ dingtalk_layout .addLayout (secret_layout )
1869+
18631870 dingtalk_group .setLayout (dingtalk_layout )
18641871 layout .addWidget (dingtalk_group )
18651872
@@ -1946,6 +1953,7 @@ def load_settings(self):
19461953 self .popup_enabled .setChecked (settings ['popup_enabled' ])
19471954 self .dingtalk_enabled .setChecked (settings ['dingtalk_enabled' ])
19481955 self .dingtalk_webhook .setText (settings ['dingtalk_webhook' ])
1956+ self .dingtalk_secret .setText (settings ['dingtalk_secret' ])
19491957 self .rise_threshold .setValue (settings ['rise_threshold' ])
19501958 self .fall_threshold .setValue (settings ['fall_threshold' ])
19511959 self .profit_threshold .setValue (settings ['profit_threshold' ])
@@ -1962,6 +1970,7 @@ def save_settings(self):
19621970 SET popup_enabled = ?,
19631971 dingtalk_enabled = ?,
19641972 dingtalk_webhook = ?,
1973+ dingtalk_secret = ?,
19651974 rise_threshold = ?,
19661975 fall_threshold = ?,
19671976 profit_threshold = ?,
@@ -1972,6 +1981,7 @@ def save_settings(self):
19721981 self .popup_enabled .isChecked (),
19731982 self .dingtalk_enabled .isChecked (),
19741983 self .dingtalk_webhook .text (),
1984+ self .dingtalk_secret .text (),
19751985 self .rise_threshold .value (),
19761986 self .fall_threshold .value (),
19771987 self .profit_threshold .value (),
0 commit comments