From da505c84c6dd50e1eecda8baf9bd2d2584efe9cd Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 30 Nov 2018 14:44:49 +0100 Subject: [PATCH] Expose config.val to extension API --- qutebrowser/api/config.py | 26 ++++++++++++++++++++++++++ qutebrowser/config/configinit.py | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 qutebrowser/api/config.py diff --git a/qutebrowser/api/config.py b/qutebrowser/api/config.py new file mode 100644 index 000000000..c1394d46a --- /dev/null +++ b/qutebrowser/api/config.py @@ -0,0 +1,26 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2018 Florian Bruhin (The Compiler) +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see . + +"""Access to the qutebrowser configuration.""" + +import typing + +from qutebrowser.config import config + +val = typing.cast('config.ConfigContainer', None) diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 8480889af..de9651064 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -24,6 +24,7 @@ import sys from PyQt5.QtWidgets import QMessageBox +from qutebrowser.api import config as configapi from qutebrowser.config import (config, configdata, configfiles, configtypes, configexc, configcommands) from qutebrowser.utils import (objreg, usertypes, log, standarddir, message, @@ -44,6 +45,7 @@ def early_init(args): config.instance = config.Config(yaml_config=yaml_config) config.val = config.ConfigContainer(config.instance) + configapi.val = config.ConfigContainer(config.instance) config.key_instance = config.KeyConfig(config.instance) config.cache = configcache.ConfigCache() yaml_config.setParent(config.instance)