diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 3bd5569ee..0b46730f8 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1547,7 +1547,7 @@ class CommandDispatcher: raise cmdexc.CommandError("Invalid help topic {}!".format( topic)) try: - config.get(*parts) + config.instance.get(*parts) except configexc.NoSectionError: raise cmdexc.CommandError("Invalid section {}!".format( parts[0])) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 7b10ef30b..c642a56ab 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -91,8 +91,7 @@ def immediate_download_path(prompt_download_directory=None): storage->prompt-download-directory setting. """ if prompt_download_directory is None: - prompt_download_directory = config.get('storage', - 'prompt-download-directory') + prompt_download_directory = config.val.downloads.location.prompt if not prompt_download_directory: return download_dir() @@ -104,7 +103,7 @@ def _path_suggestion(filename): Args: filename: The filename to use if included in the suggestion. """ - suggestion = config.val.completion.downloads.location.suggestion + suggestion = config.val.downloads.location.suggestion if suggestion == 'path': # add trailing '/' if not present return os.path.join(download_dir(), '') @@ -473,10 +472,10 @@ class AbstractDownloadItem(QObject): position: The color type requested, can be 'fg' or 'bg'. """ assert position in ["fg", "bg"] - start = config.get('colors', 'downloads.{}.start'.format(position)) - stop = config.get('colors', 'downloads.{}.stop'.format(position)) - system = config.get('colors', 'downloads.{}.system'.format(position)) - error = config.get('colors', 'downloads.{}.error'.format(position)) + start = getattr(config.val.colors.downloads.start, position) + stop = getattr(config.val.colors.downloads.stop, position) + system = getattr(config.val.colors.downloads.system, position) + error = getattr(config.val.colors.downloads.error, position) if self.error_msg is not None: assert not self.successful return error diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 92126c6ad..a77853908 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -80,10 +80,10 @@ def _find_prevnext(prev, elems): # Then check for regular links/buttons. elems = [e for e in elems if e.tag_name() != 'link'] - option = 'prev-regexes' if prev else 'next-regexes' + option = 'prev_regexes' if prev else 'next_regexes' if not elems: return None - for regex in config.get('hints', option): + for regex in getattr(config.val.hints, option): log.hints.vdebug("== Checking regex '{}'.".format(regex.pattern)) for e in elems: text = str(e) diff --git a/qutebrowser/browser/shared.py b/qutebrowser/browser/shared.py index 670c9f4f8..f0a961436 100644 --- a/qutebrowser/browser/shared.py +++ b/qutebrowser/browser/shared.py @@ -180,7 +180,7 @@ def feature_permission(url, option, msg, yes_action, no_action, abort_on): Return: The Question object if a question was asked, None otherwise. """ - config_val = config.get(*option) + config_val = config.instance.get(*option) if config_val == 'ask': if url.isValid(): text = "Allow the website at {} to {}?".format( diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 569bd27d2..8a942632b 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -58,11 +58,6 @@ val = None instance = None -def get(*args, **kwargs): - """Convenience method to call get(...) of the config instance.""" - return instance.get(*args, **kwargs) - - def _init_main_config(parent=None): """Initialize the main config. diff --git a/qutebrowser/misc/lineparser.py b/qutebrowser/misc/lineparser.py index 97b22508c..bd07f7903 100644 --- a/qutebrowser/misc/lineparser.py +++ b/qutebrowser/misc/lineparser.py @@ -291,14 +291,14 @@ class LimitLineParser(LineParser): assert self._configfile is not None if option != self._limit: return - value = config.get(option) + value = config.instance.get(option) if value == 0: if os.path.exists(self._configfile): os.remove(self._configfile) def save(self): """Save the config file.""" - limit = config.get(self._limit) + limit = config.instance.get(self._limit) if limit == 0: return do_save = self._prepare_save() diff --git a/qutebrowser/misc/savemanager.py b/qutebrowser/misc/savemanager.py index 8bef9b163..926bf1230 100644 --- a/qutebrowser/misc/savemanager.py +++ b/qutebrowser/misc/savemanager.py @@ -81,7 +81,7 @@ class Saveable: force: Force saving, no matter what. """ if (self._config_opt is not None and - (not config.get(self._config_opt)) and + (not config.instance.get(self._config_opt)) and (not explicit) and (not force)): if not silent: log.save.debug("Not saving {name} because autosaving has been "