Make clearing config work

This commit is contained in:
Florian Bruhin 2018-02-19 05:08:17 +01:00
parent a6b979539d
commit 9c670e13ce
3 changed files with 8 additions and 6 deletions

View File

@ -414,10 +414,8 @@ class Config(QObject):
If save_yaml=True is given, also remove all customization from the YAML
file.
"""
# FIXME:conf support per-URL settings?
old_values = self._values
self._values = {}
for name in old_values:
for name, values in self._values.items():
values.clear()
self.changed.emit(name)
if save_yaml:

View File

@ -239,8 +239,8 @@ class YamlConfig(QObject):
def clear(self):
"""Clear all values from the YAML file."""
# FIXME:conf per-URL support?
self._values = []
for values in self._values.values():
values.clear()
self._mark_changed()

View File

@ -90,6 +90,10 @@ class Values:
# FIXME:conf Should this ignore patterns which weren't found?
self._values = [v for v in self._values if v.pattern != pattern]
def clear(self):
"""Clear all customization for this value."""
self._values = []
def _get_fallback(self):
"""Get the fallback global/default value."""
if self._values: