Make webkitelem/mhtml imports optional in commands
This commit is contained in:
parent
bf3cccfe56
commit
3b8537ff26
@ -44,7 +44,13 @@ from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
|
|||||||
from qutebrowser.config import config, configexc
|
from qutebrowser.config import config, configexc
|
||||||
from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
|
from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
|
||||||
webelem)
|
webelem)
|
||||||
from qutebrowser.browser.webkit import webkitelem, downloads, mhtml
|
from qutebrowser.browser.webkit import downloads
|
||||||
|
try:
|
||||||
|
from qutebrowser.browser.webkit import webkitelem, mhtml
|
||||||
|
except ImportError:
|
||||||
|
# Failing imports on QtWebEngine, only used in QtWebKit commands.
|
||||||
|
# FIXME:qtwebengine don't import this anymore at all
|
||||||
|
pass
|
||||||
from qutebrowser.keyinput import modeman
|
from qutebrowser.keyinput import modeman
|
||||||
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
|
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
|
||||||
objreg, utils, typing, javascript)
|
objreg, utils, typing, javascript)
|
||||||
@ -1493,8 +1499,8 @@ class CommandDispatcher:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
elem.set_text(text, use_js=True)
|
elem.set_text(text, use_js=True)
|
||||||
except webkitelem.IsNullError:
|
except webelem.Error as e:
|
||||||
raise cmdexc.CommandError("Element vanished while editing!")
|
raise cmdexc.CommandError(str(e))
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher',
|
@cmdutils.register(instance='command-dispatcher',
|
||||||
deprecated="Use :insert-text {primary}",
|
deprecated="Use :insert-text {primary}",
|
||||||
|
Loading…
Reference in New Issue
Block a user