mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-12 17:28:35 +03:00
Restore rejected settings toggles
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -215,10 +215,11 @@ class _ToggleSettingsCard(_SettingsCard):
|
||||
):
|
||||
"""Initialize a persistent binary setting card."""
|
||||
self.settingName = settingName
|
||||
self._callback = callback
|
||||
|
||||
self.checkBox = AppQSwitch()
|
||||
self.checkBox.syncChecked(AppSettings.isStateON_(settingName))
|
||||
self.checkBox.toggled.connect(callback)
|
||||
self.checkBox.toggled.connect(self._requestedState)
|
||||
|
||||
super().__init__(
|
||||
iconFileName,
|
||||
@@ -229,6 +230,12 @@ class _ToggleSettingsCard(_SettingsCard):
|
||||
parent=parent,
|
||||
)
|
||||
|
||||
@QtCore.Slot(bool)
|
||||
def _requestedState(self, checked: bool):
|
||||
"""Apply a requested setting and restore persisted state on failure."""
|
||||
if self._callback(checked) is False:
|
||||
self.sync()
|
||||
|
||||
def sync(self):
|
||||
"""Refresh the control from persistent state without applying it."""
|
||||
self.checkBox.syncChecked(AppSettings.isStateON_(self.settingName))
|
||||
@@ -405,6 +412,8 @@ class _LanguageSettingsCard(_SettingsCard):
|
||||
|
||||
def __init__(self, title='', description='', parent=None):
|
||||
"""Initialize the stable language-name selector."""
|
||||
# These are intentional native-language representations (for example,
|
||||
# "Русский" and "简体中文"), not strings in the active UI locale.
|
||||
self.comboBox = QComboBox()
|
||||
self.comboBox.setObjectName('SettingsComboBox')
|
||||
self.comboBox.setMinimumWidth(180)
|
||||
|
||||
Reference in New Issue
Block a user