diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-01-28 16:22:46 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-01-28 16:23:09 +0100 |
commit | d2f0cad2c7610b62c24648db5efdfa2c7410637f (patch) | |
tree | 57c29a56cefb0429dcc3d1b1f439deed7363ab64 /qutebrowser/components/braveadblock.py | |
parent | 5253610259ffa0aea33f013866bd59cc8b149003 (diff) | |
download | qutebrowser-d2f0cad2c7610b62c24648db5efdfa2c7410637f.tar.gz qutebrowser-d2f0cad2c7610b62c24648db5efdfa2c7410637f.zip |
Handle install of adblock library during runtime
The _possibly_show_missing_dependency_warning() is only shown if the
"adblock" import is unavailable (i.e. None), thus we assumed that it
must be either not installed or outdated.
However, there's a third possible case: The library wasn't available at
import time, but it *is* available when the setting changed at runtime.
If that's the case, show a warning instead of an AssertionError.
Diffstat (limited to 'qutebrowser/components/braveadblock.py')
-rw-r--r-- | qutebrowser/components/braveadblock.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py index 68196255c..a851ff513 100644 --- a/qutebrowser/components/braveadblock.py +++ b/qutebrowser/components/braveadblock.py @@ -74,12 +74,16 @@ def _possibly_show_missing_dependency_warning() -> None: f"Installed version {adblock_info.get_version()} of the 'adblock' " f"dependency is too old. Minimum supported is {adblock_info.min_version}." ) - else: - assert not adblock_info.is_installed(), adblock_info + elif not adblock_info.is_installed(): message.warning( f"Ad blocking method is set to '{method}' but 'adblock' dependency is not " "installed." ) + else: + message.warning( + "The 'adblock' dependency was unavailable when qutebrowser was started, " + "but now seems to be installed. Please :restart qutebrowser to use it." + ) _RESOURCE_TYPE_STRINGS = { |