diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-03-22 13:37:12 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-03-23 12:53:23 +0100 |
commit | 3e4e59f028d7b5e0a46a18b9a3e72c1ade548897 (patch) | |
tree | f75e48478c0377588bcf9c0c9716834211c36e1c | |
parent | ac52268a4599cf6bfc32885bb4eb6586288ffded (diff) | |
download | qutebrowser-3e4e59f028d7b5e0a46a18b9a3e72c1ade548897.tar.gz qutebrowser-3e4e59f028d7b5e0a46a18b9a3e72c1ade548897.zip |
Circular import workarounds
-rw-r--r-- | qutebrowser/browser/hints.py | 5 | ||||
-rw-r--r-- | qutebrowser/mainwindow/mainwindow.py | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 333c532d3..3a7f949ce 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -36,7 +36,7 @@ from PyQt5.QtWidgets import QLabel from qutebrowser.config import config, configexc from qutebrowser.keyinput import modeman, modeparsers, basekeyparser from qutebrowser.browser import webelem, history -from qutebrowser.commands import userscripts, runners +from qutebrowser.commands import runners from qutebrowser.api import cmdutils from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils if TYPE_CHECKING: @@ -320,6 +320,9 @@ class HintActions: elem: The QWebElement to use in the userscript. context: The HintContext to use. """ + # lazy import to avoid circular import issues + from qutebrowser.commands import userscripts + cmd = context.args[0] args = context.args[1:] env = { diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index ae30c6352..d0723742a 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -38,7 +38,7 @@ from qutebrowser.utils import (message, log, usertypes, qtutils, objreg, utils, from qutebrowser.mainwindow import messageview, prompt from qutebrowser.completion import completionwidget, completer from qutebrowser.keyinput import modeman -from qutebrowser.browser import commands, downloadview, hints, downloads +from qutebrowser.browser import downloadview, hints, downloads from qutebrowser.misc import crashsignal, keyhintwidget, sessions, objects from qutebrowser.qt import sip @@ -381,6 +381,8 @@ class MainWindow(QWidget): self._add_overlay(self._completion, self._completion.update_geometry) def _init_command_dispatcher(self): + # Lazy import to avoid circular imports + from qutebrowser.browser import commands self._command_dispatcher = commands.CommandDispatcher( self.win_id, self.tabbed_browser) objreg.register('command-dispatcher', |