1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-17 23:13:03 +08:00

refactor(gui): 将主题控件样式修改迁移至 .ui 文件

- ThemeComboBox 移入 ALEttingsWidget.ui,由 setupUi 创建
- QssPathEdit/ApplyQssButton 的隐藏改为 .ui 的 visible=false
- BrowseQssButton/ResetQssButton/CustomQssHintLabel 文本直接在 .ui 中定义
- ALSettingsWidget.modifyUi 移除冗余的程序化 UI 修改
- 移除 ThemeStatusLabel 别名,直接使用 QssStatusLabel
This commit is contained in:
2026-05-30 21:11:01 +08:00
parent 35253dadbb
commit 38489191f5
2 changed files with 22 additions and 22 deletions
+2 -12
View File
@@ -24,7 +24,6 @@ from PySide6.QtGui import (
)
from PySide6.QtWidgets import (
QApplication,
QComboBox,
QFileDialog,
QMessageBox,
QStyleFactory,
@@ -143,15 +142,6 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
self.NavigationList.setCurrentRow(0)
self.populateStyles()
self.setNavigationIcons()
self.QssPathEdit.hide()
self.ApplyQssButton.hide()
self.ResetQssButton.setText("重置主题")
self.CustomQssHintLabel.setText("选择一个主题,或导入新的主题文件:")
self.ThemeComboBox = QComboBox(self.CustomQssGroupBox)
self.ThemeComboBox.setObjectName("ThemeComboBox")
self.ThemeComboBox.setMinimumSize(160, 25)
self.QssPathLayout.insertWidget(0, self.ThemeComboBox)
self.ThemeStatusLabel = self.QssStatusLabel
def setNavigationIcons(
self
@@ -247,9 +237,9 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
name = self.ThemeComboBox.currentText()
if name:
self.ThemeStatusLabel.setText(f"已加载主题:{name}")
self.QssStatusLabel.setText(f"已加载主题:{name}")
else:
self.ThemeStatusLabel.setText("当前使用程序默认外观。")
self.QssStatusLabel.setText("当前使用程序默认外观。")
def collectSettings(
self
+20 -10
View File
@@ -259,7 +259,7 @@
<item>
<widget class="QLabel" name="CustomQssHintLabel">
<property name="text">
<string>自定义程序外观,文件加载后将立即生效。</string>
<string>选择一个主题,或导入新的主题文件:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -271,8 +271,21 @@
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QComboBox" name="ThemeComboBox">
<property name="minimumSize">
<size>
<width>160</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="QssPathEdit">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -288,18 +301,12 @@
<widget class="QPushButton" name="BrowseQssButton">
<property name="minimumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<width>60</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>...</string>
<string>导入</string>
</property>
</widget>
</item>
@@ -312,6 +319,9 @@
</property>
<item>
<widget class="QPushButton" name="ApplyQssButton">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
@@ -332,7 +342,7 @@
</size>
</property>
<property name="text">
<string>重置外观</string>
<string>重置主题</string>
</property>
</widget>
</item>