1313from Pages .PageLaunch .PageLaunch import PageLaunch
1414
1515class Ui_FormMain (object ):
16-
1716 def setupUi (self , FormMain : QtWidgets .QWidget ):
1817 # 获取所有需要的设置项
19- size = setup . SIZE
20-
21- corner_radius = setup .CORNER_RADIUS
22- bg_color = setup .color_brush_5
23- fg_color = setup .color_brush_2
24-
18+ setup = Setup ()
19+ size = setup . get_settings ( 'size' )
20+ corner_radius = setup .get_settings ( 'corner_radius' )
21+ bg_color = setup .get_settings ( 'ColorBrush5' )
22+ fg_color = setup .get_settings ( 'ColorBrush2' )
23+
2524 FormMain .setObjectName ("FormMain" )
2625 FormMain .resize (* size )
2726 FormMain .setBaseSize (QtCore .QSize (* size ))
2827 FormMain .setStyleSheet (f"background-color: transparent; " )
2928 icon = QtGui .QIcon ()
30- icon .addPixmap (
31- QtGui .QPixmap (":/.ico/icon.ico" ), QtGui .QIcon .Normal , QtGui .QIcon .Off
32- )
29+ icon .addPixmap (QtGui .QPixmap (":/.ico/icon.ico" ), QtGui .QIcon .Normal , QtGui .QIcon .Off )
3330 FormMain .setWindowIcon (icon )
34-
31+
3532 # 标题栏 Panel
3633 self .PanTitle = QtWidgets .QFrame (FormMain )
3734 title_height = 48
@@ -45,10 +42,9 @@ def setupUi(self, FormMain: QtWidgets.QWidget):
4542 border-top-right-radius: { corner_radius } px;
4643 border-bottom: none;
4744 }}
48- """
49- )
50- self .PanTitle .setFrameShape (QtWidgets .QFrame .NoFrame )
51- self .PanTitle .setFrameShadow (QtWidgets .QFrame .Plain )
45+ """ )
46+ self .PanTitle .setFrameShape (QtWidgets .QFrame .NoFrame )
47+ self .PanTitle .setFrameShadow (QtWidgets .QFrame .Plain )
5248 self .PanTitle .setObjectName ("PanTitle" )
5349
5450 # 主 Panel
@@ -61,34 +57,25 @@ def setupUi(self, FormMain: QtWidgets.QWidget):
6157 border-bottom-left-radius: { corner_radius } px;
6258 border-bottom-right-radius: { corner_radius } px;
6359 }}
64- """
65- )
66- self .PanMain .setFrameShape (QtWidgets .QFrame .NoFrame )
67- self .PanMain .setFrameShadow (QtWidgets .QFrame .Plain )
60+ """ )
61+ self .PanMain .setFrameShape (QtWidgets .QFrame .NoFrame )
62+ self .PanMain .setFrameShadow (QtWidgets .QFrame .Plain )
6863 self .PanMain .setObjectName ("PanMain" )
6964
7065 # 标题栏按钮 -- 退出
71- self .BtnExit = MyRoundButton (
72- self .PanTitle ,
73- svg_path = "Images/BtnTitleClose.svg" ,
74- size = (14 , 14 ),
75- tooltip = "Exit" ,
76- padding = (7 , 7 , - 10 , - 10 ),
77- )
78- self .BtnExit .setGeometry (QtCore .QRect ((size [0 ] - 50 ), 15 , 14 , 14 ))
66+ self .BtnExit = MyRoundButton (self .PanTitle , svg_path = "Images/BtnTitleExit.svg" , size = (36 , 36 ), tooltip = "Exit" )
67+ self .BtnExit .setGeometry (QtCore .QRect ((size [0 ] - 72 ), 8 , 36 , 36 ))
7968 self .BtnExit .setObjectName ("BtnExit" )
8069
8170 # 标题栏按钮 -- 最小化
82- self .BtnMin = QtWidgets .QPushButton (self .PanTitle )
83- self .BtnMin .setGeometry (QtCore .QRect ((size [0 ] - 98 ), 2 , 40 , 40 ))
84- self .BtnMin .setStyleSheet ("background-color: transparent;" )
85- self .BtnMin .setText ("—" )
71+ self .BtnMin = MyRoundButton (self .PanTitle , svg_path = "Images/BtnTitleMin.svg" , size = (36 , 36 ), tooltip = "Minisize" )
72+ self .BtnMin .setGeometry (QtCore .QRect ((size [0 ] - 120 ), 8 , 36 , 36 ))
8673 self .BtnMin .setObjectName ("BtnMin" )
8774
8875 # 标题栏标签 -- 标题
8976 self .SVGTitle = QSvgWidget (self .PanTitle )
9077 self .SVGTitle .load ("Images/svgtitle.svg" )
91- self .SVGTitle .setGeometry (QtCore .QRect (2 , 14 , 76 , 24 ))
78+ self .SVGTitle .setGeometry (QtCore .QRect (8 , 8 , 120 , 40 )) # 缩小尺寸
9279 self .SVGTitle .setStyleSheet ("background-color: transparent;" )
9380 self .SVGTitle .setObjectName ("SVGTitle" )
9481
@@ -104,5 +91,4 @@ def retranslateUi(self, FormMain: QtWidgets.QWidget):
10491 _translate = QtCore .QCoreApplication .translate
10592 FormMain .setWindowTitle (_translate ("FormMain" , "Plain Craft Launcher 2" ))
10693
107-
10894from Resources import *
0 commit comments