From c214acd8992a90c5b9f8c52d3fe0f97cc9d24ab8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Jul 2017 14:29:19 +0200 Subject: [PATCH] Remove config from objreg --- qutebrowser/app.py | 3 +-- qutebrowser/config/config.py | 12 +++++------- tests/unit/config/test_config.py | 1 - 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index bbe98232f..3b416ed0b 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -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)) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 696e1f4c4..1102fb93a 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -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) diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 42eb20169..eacd5b4c3 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -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')