mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 07:23: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:
@@ -24,7 +24,6 @@ from PySide6.QtGui import (
|
|||||||
)
|
)
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
QComboBox,
|
|
||||||
QFileDialog,
|
QFileDialog,
|
||||||
QMessageBox,
|
QMessageBox,
|
||||||
QStyleFactory,
|
QStyleFactory,
|
||||||
@@ -143,15 +142,6 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
self.NavigationList.setCurrentRow(0)
|
self.NavigationList.setCurrentRow(0)
|
||||||
self.populateStyles()
|
self.populateStyles()
|
||||||
self.setNavigationIcons()
|
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(
|
def setNavigationIcons(
|
||||||
self
|
self
|
||||||
@@ -247,9 +237,9 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
|
|
||||||
name = self.ThemeComboBox.currentText()
|
name = self.ThemeComboBox.currentText()
|
||||||
if name:
|
if name:
|
||||||
self.ThemeStatusLabel.setText(f"已加载主题:{name}")
|
self.QssStatusLabel.setText(f"已加载主题:{name}")
|
||||||
else:
|
else:
|
||||||
self.ThemeStatusLabel.setText("当前使用程序默认外观。")
|
self.QssStatusLabel.setText("当前使用程序默认外观。")
|
||||||
|
|
||||||
def collectSettings(
|
def collectSettings(
|
||||||
self
|
self
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="CustomQssHintLabel">
|
<widget class="QLabel" name="CustomQssHintLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>自定义程序外观,文件加载后将立即生效。</string>
|
<string>选择一个主题,或导入新的主题文件:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -271,8 +271,21 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="ThemeComboBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="QssPathEdit">
|
<widget class="QLineEdit" name="QssPathEdit">
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@@ -288,18 +301,12 @@
|
|||||||
<widget class="QPushButton" name="BrowseQssButton">
|
<widget class="QPushButton" name="BrowseQssButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>25</width>
|
<width>60</width>
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>25</width>
|
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>导入</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -312,6 +319,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ApplyQssButton">
|
<widget class="QPushButton" name="ApplyQssButton">
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
@@ -332,7 +342,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>重置外观</string>
|
<string>重置主题</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user