Fix newconfig init

This commit is contained in:
Florian Bruhin 2017-06-13 11:34:37 +02:00
parent 3009e5eebe
commit b5110b07f0
2 changed files with 11 additions and 9 deletions

View File

@ -248,12 +248,6 @@ def _init_misc():
QSettings.setPath(fmt, QSettings.UserScope, path)
def _init_new_config(parent):
new_config = newconfig.NewConfigManager(parent)
new_config.read_defaults()
objreg.register('config', new_config)
def init(parent=None):
"""Initialize the config.
@ -263,7 +257,7 @@ def init(parent=None):
global val
# _init_main_config(parent)
configdata.init()
_init_new_config(parent)
newconfig.init(parent)
val = newconfig.val
_init_key_config(parent)
_init_misc()

View File

@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSignal, QObject
from qutebrowser.config import configdata
from qutebrowser.utils import utils
from qutebrowser.utils import utils, objreg
# An easy way to access the config from other code via config.val.foo
val = None
@ -66,7 +66,7 @@ class NewConfigManager(QObject):
val = self._values[option]
except KeyError as e:
raise UnknownOptionError(e)
return val.typ.transform(val.default)
return val.typ.from_py(val.default)
def is_valid_prefix(self, prefix):
"""Check whether the given prefix is a valid prefix for some option."""
@ -115,3 +115,11 @@ class ConfigContainer:
return '{}.{}'.format(self._prefix, attr)
else:
return attr
def init(parent):
new_config = NewConfigManager(parent)
new_config.read_defaults()
objreg.register('config', new_config)
global val
val = ConfigContainer(new_config)