Remove config from objreg

This commit is contained in:
Florian Bruhin 2017-07-03 14:29:19 +02:00
parent f8a88ae042
commit c214acd899
3 changed files with 6 additions and 10 deletions

View File

@ -181,10 +181,9 @@ def _init_icon():
def _process_args(args):
"""Open startpage etc. and process commandline args."""
config_obj = objreg.get('config')
for opt, val in args.temp_settings:
try:
config_obj.set_str(opt, val)
config.instance.set_str(opt, val)
except configexc.Error as e:
message.error("set: {} - {}".format(e.__class__.__name__, e))

View File

@ -605,19 +605,17 @@ def init(parent=None):
configdata.init()
yaml_config = configfiles.YamlConfig()
config = Config(yaml_config=yaml_config, parent=parent)
objreg.register('config', config)
global val, instance, key_instance
val = ConfigContainer(config)
instance = config
key_instance = KeyConfig(config)
instance = Config(yaml_config=yaml_config, parent=parent)
val = ConfigContainer(instance)
key_instance = KeyConfig(instance)
config_commands = ConfigCommands(config, key_instance)
config_commands = ConfigCommands(instance, key_instance)
objreg.register('config-commands', config_commands)
for cf in _change_filters:
cf.validate()
config.read_yaml()
instance.read_yaml()
configfiles.init(instance)

View File

@ -825,7 +825,6 @@ def init_patch(qapp, fake_save_manager, monkeypatch, config_tmpdir,
monkeypatch.setattr(config, 'key_instance', None)
monkeypatch.setattr(config, '_change_filters', [])
yield
objreg.delete('config')
objreg.delete('config-commands')
try:
objreg.delete('state-config')