Add some more logging for #549.

This commit is contained in:
Florian Bruhin 2015-03-16 15:41:51 +01:00
parent cef49864d9
commit b1f99392e8

View File

@ -65,11 +65,15 @@ class Base:
Args: Args:
qws: The QWebSettings instance to use, or None to use the global qws: The QWebSettings instance to use, or None to use the global
instance. instance.
Return:
The saved default value.
""" """
try: try:
self._default = self.get(qws) self._default = self.get(qws)
return self._default
except AttributeError: except AttributeError:
pass return None
def restore_default(self, qws=None): def restore_default(self, qws=None):
"""Restore the default value from the saved one. """Restore the default value from the saved one.
@ -80,6 +84,7 @@ class Base:
qws: The QWebSettings instance to use, or None to use the global qws: The QWebSettings instance to use, or None to use the global
instance. instance.
""" """
log.misc.vdebug("Restoring default {!r}.".format(self._default))
if self._default is not UNSET: if self._default is not UNSET:
self._set(self._default, qws=qws) self._set(self._default, qws=qws)
@ -200,11 +205,12 @@ class NullStringSetter(Setter):
try: try:
val = self.get(qws) val = self.get(qws)
except AttributeError: except AttributeError:
pass return None
if val == '': if val == '':
self._set(None, qws=qws) self._set(None, qws=qws)
else: else:
self._set(val, qws=qws) self._set(val, qws=qws)
return val
class GlobalSetter(Setter): class GlobalSetter(Setter):
@ -373,10 +379,12 @@ def init():
for sectname, section in MAPPINGS.items(): for sectname, section in MAPPINGS.items():
for optname, mapping in section.items(): for optname, mapping in section.items():
mapping.save_default() default = mapping.save_default()
log.misc.vdebug("Saved default for {} -> {}: {!r}".format(
sectname, optname, default))
value = config.get(sectname, optname) value = config.get(sectname, optname)
log.misc.debug("Setting {} -> {} to {!r}".format(sectname, optname, log.misc.vdebug("Setting {} -> {} to {!r}".format(
value)) sectname, optname, value))
mapping.set(value) mapping.set(value)
objreg.get('config').changed.connect(update_settings) objreg.get('config').changed.connect(update_settings)