1313import webbrowser
1414
1515from PyQt5 .QtCore import pyqtSlot , QUrl
16+ from PyQt5 .QtGui import QColor
1617from PyQt5 .QtWebKit import QWebSettings
1718from PyQt5 .QtWebKitWidgets import QWebPage
1819
1920from Utils import Constants
20- from Utils .CommonUtil import Signals
21+ from Utils .CommonUtil import Signals , Setting , AppLog
22+ from Utils .GradientUtils import GradientUtils
2123from Utils .NetworkAccessManager import NetworkAccessManager
2224from Utils .ThemeManager import ThemeManager
25+ from Widgets .Dialogs .SkinDialog import SkinDialog
2326from Widgets .ToolTip import ToolTip
2427
2528
@@ -36,8 +39,6 @@ def _initUi(self):
3639 self .buttonNormal .setVisible (False )
3740 # 隐藏目录树的滑动条
3841 self .treeViewCatalogs .verticalScrollBar ().setVisible (False )
39- # 加载主题
40- ThemeManager .loadTheme ()
4142 # 加载鼠标样式
4243 ThemeManager .loadCursor (self .widgetMain )
4344 ThemeManager .setPointerCursors ([
@@ -56,6 +57,22 @@ def _initUi(self):
5657 ToolTip .bind (self .buttonHome )
5758 # 头像提示控件
5859 ToolTip .bind (self .buttonHead )
60+ # 加载主题
61+ colourful = Setting .value ('colourful' )
62+ picture = Setting .value ('picture' , '' , str )
63+ AppLog .debug ('colourful: %s' , str (colourful ))
64+ AppLog .debug ('picture: %s' , picture )
65+ if picture :
66+ ThemeManager .loadPictureTheme (picture )
67+ elif colourful :
68+ if isinstance (picture , QColor ):
69+ ThemeManager .loadColourfulTheme (colourful )
70+ else :
71+ # json数据转渐变
72+ ThemeManager .loadColourfulTheme (
73+ GradientUtils .toGradient (colourful ))
74+ else :
75+ ThemeManager .loadTheme ()
5976
6077 def _initSignals (self ):
6178 """初始化信号槽"""
@@ -94,7 +111,9 @@ def _initWebView(self):
94111 def on_buttonSkin_clicked (self ):
95112 """选择主题样式
96113 """
97- pass
114+ if not hasattr (self , 'skinDialog' ):
115+ self .skinDialog = SkinDialog (self )
116+ self .skinDialog .exec_ ()
98117
99118 @pyqtSlot ()
100119 def on_buttonIssues_clicked (self ):
0 commit comments