mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 07:23:03 +08:00
refactor(gui): currentTextChanged → currentIndexChanged,ResetQssButton → ResetThemeButton
- ThemeComboBox 改用 currentIndexChanged(int) 信号 - ResetQssButton 重命名为 ResetThemeButton(.ui/.py 同步) - 重置按钮行为改为恢复至原始主题并立即应用(saveAndApply)
This commit is contained in:
+27
-12
@@ -151,8 +151,8 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
):
|
):
|
||||||
|
|
||||||
self.BrowseQssButton.clicked.connect(self.onImportThemeButtonClicked)
|
self.BrowseQssButton.clicked.connect(self.onImportThemeButtonClicked)
|
||||||
self.ThemeComboBox.currentTextChanged.connect(self.onThemeComboBoxChanged)
|
self.ThemeComboBox.currentIndexChanged.connect(self.onThemeComboBoxChanged)
|
||||||
self.ResetQssButton.clicked.connect(self.onResetQssButtonClicked)
|
self.ResetThemeButton.clicked.connect(self.onResetThemeButtonClicked)
|
||||||
self.CancelButton.clicked.connect(self.onCancelButtonClicked)
|
self.CancelButton.clicked.connect(self.onCancelButtonClicked)
|
||||||
self.ApplyButton.clicked.connect(self.onApplyButtonClicked)
|
self.ApplyButton.clicked.connect(self.onApplyButtonClicked)
|
||||||
self.ConfirmButton.clicked.connect(self.onConfirmButtonClicked)
|
self.ConfirmButton.clicked.connect(self.onConfirmButtonClicked)
|
||||||
@@ -212,7 +212,7 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
if idx >= 0:
|
if idx >= 0:
|
||||||
self.ThemeComboBox.setCurrentIndex(idx)
|
self.ThemeComboBox.setCurrentIndex(idx)
|
||||||
self.updateThemeStatus()
|
self.updateThemeStatus()
|
||||||
self._updateThemeInfo()
|
self.updateThemeInfo()
|
||||||
|
|
||||||
def updateThemeStatus(
|
def updateThemeStatus(
|
||||||
self
|
self
|
||||||
@@ -224,7 +224,7 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
else:
|
else:
|
||||||
self.QssStatusLabel.setText("当前使用 默认 主题。")
|
self.QssStatusLabel.setText("当前使用 默认 主题。")
|
||||||
|
|
||||||
def _updateThemeInfo(
|
def updateThemeInfo(
|
||||||
self
|
self
|
||||||
):
|
):
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
else:
|
else:
|
||||||
self.ThemeInfoLabel.setText("")
|
self.ThemeInfoLabel.setText("")
|
||||||
|
|
||||||
def _syncRadioFromNeedTheme(
|
def syncRadioFromNeedTheme(
|
||||||
self,
|
self,
|
||||||
name: str
|
name: str
|
||||||
):
|
):
|
||||||
@@ -278,12 +278,12 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
self.__cfg_mgr.set(CfgKey.GLOBAL.APPEARANCE.STYLE, style)
|
self.__cfg_mgr.set(CfgKey.GLOBAL.APPEARANCE.STYLE, style)
|
||||||
self.__cfg_mgr.set(CfgKey.GLOBAL.APPEARANCE.CUSTOM_THEME, custom_theme)
|
self.__cfg_mgr.set(CfgKey.GLOBAL.APPEARANCE.CUSTOM_THEME, custom_theme)
|
||||||
_applyCustomTheme(custom_theme, theme)
|
_applyCustomTheme(custom_theme, theme)
|
||||||
self._syncRadioFromNeedTheme(custom_theme)
|
self.syncRadioFromNeedTheme(custom_theme)
|
||||||
theme, _, _ = self.collectSettings()
|
theme, _, _ = self.collectSettings()
|
||||||
_applyTheme(theme)
|
_applyTheme(theme)
|
||||||
self.setNavigationIcons()
|
self.setNavigationIcons()
|
||||||
self.updateThemeStatus()
|
self.updateThemeStatus()
|
||||||
self._updateThemeInfo()
|
self.updateThemeInfo()
|
||||||
self.__original_style = self.currentStyleKey()
|
self.__original_style = self.currentStyleKey()
|
||||||
|
|
||||||
def maybeRestart(
|
def maybeRestart(
|
||||||
@@ -338,7 +338,7 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
if idx >= 0:
|
if idx >= 0:
|
||||||
self.ThemeComboBox.setCurrentIndex(idx)
|
self.ThemeComboBox.setCurrentIndex(idx)
|
||||||
self.updateThemeStatus()
|
self.updateThemeStatus()
|
||||||
self._updateThemeInfo()
|
self.updateThemeInfo()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QMessageBox.warning(
|
QMessageBox.warning(
|
||||||
self,
|
self,
|
||||||
@@ -348,17 +348,32 @@ class ALSettingsWidget(QWidget, Ui_ALSettingsWidget):
|
|||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def onThemeComboBoxChanged(
|
def onThemeComboBoxChanged(
|
||||||
self
|
self,
|
||||||
|
index: int
|
||||||
):
|
):
|
||||||
|
|
||||||
self._updateThemeInfo()
|
self.updateThemeInfo()
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def onResetQssButtonClicked(
|
def onResetThemeButtonClicked(
|
||||||
self
|
self
|
||||||
):
|
):
|
||||||
|
|
||||||
self.ThemeComboBox.setCurrentIndex(0)
|
self.ThemeComboBox.blockSignals(True)
|
||||||
|
if self.__original_custom_theme:
|
||||||
|
idx = self.ThemeComboBox.findText(self.__original_custom_theme)
|
||||||
|
if idx >= 0:
|
||||||
|
self.ThemeComboBox.setCurrentIndex(idx)
|
||||||
|
else:
|
||||||
|
self.ThemeComboBox.setCurrentIndex(0)
|
||||||
|
self.ThemeComboBox.blockSignals(False)
|
||||||
|
if self.__original_theme == "light":
|
||||||
|
self.LightThemeRadio.setChecked(True)
|
||||||
|
elif self.__original_theme == "dark":
|
||||||
|
self.DarkThemeRadio.setChecked(True)
|
||||||
|
else:
|
||||||
|
self.SystemThemeRadio.setChecked(True)
|
||||||
|
self.saveAndApply()
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def onCancelButtonClicked(
|
def onCancelButtonClicked(
|
||||||
|
|||||||
@@ -350,7 +350,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ResetQssButton">
|
<widget class="QPushButton" name="ResetThemeButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
|
|||||||
Reference in New Issue
Block a user