Add a --quiet argument to :debug-pyeval.

Closes #1156.
This commit is contained in:
Florian Bruhin 2016-01-06 06:19:37 +01:00
parent f943891ce6
commit 05281a7d1f

View File

@ -176,18 +176,23 @@ def debug_trace(expr=""):
@cmdutils.register(maxsplit=0, debug=True, no_cmd_split=True)
def debug_pyeval(s):
def debug_pyeval(s, quiet=False):
"""Evaluate a python string and display the results as a web page.
Args:
s: The string to evaluate.
quiet: Don't show the output in a new tab.
"""
try:
r = eval(s)
out = repr(r)
except Exception:
out = traceback.format_exc()
qutescheme.pyeval_output = out
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window='last-focused')
tabbed_browser.openurl(QUrl('qute:pyeval'), newtab=True)
if quiet:
log.misc.debug("pyeval output: {}".format(out))
else:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window='last-focused')
tabbed_browser.openurl(QUrl('qute:pyeval'), newtab=True)