Fix Python 3.4 circular imports

This commit is contained in:
Florian Bruhin 2017-07-03 23:28:07 +02:00
parent 9db4a8cb43
commit 91cd6c6288

View File

@ -28,9 +28,9 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QUrl
from qutebrowser.config import configdata, configexc, configtypes, configfiles
from qutebrowser.utils import (utils, objreg, message, standarddir, log,
usertypes, jinja)
usertypes)
from qutebrowser.misc import objects
from qutebrowser.commands import cmdexc, cmdutils, runners
from qutebrowser.commands import cmdexc, cmdutils
# An easy way to access the config from other code via config.val.foo
@ -174,6 +174,8 @@ class KeyConfig:
def bind(self, key, command, *, mode, force=False, save_yaml=False):
"""Add a new binding from key to command."""
# Doing this here to work around a Python 3.4 circular import
from qutebrowser.commands import runners
key = self._prepare(key, mode)
parser = runners.CommandParser()
@ -574,6 +576,8 @@ class StyleSheetObserver(QObject):
Return:
The formatted template as string.
"""
# Imported here to avoid a Python 3.4 circular import
from qutebrowser.utils import jinja
template = jinja.environment.from_string(self._stylesheet)
return template.render(conf=val)