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) @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. """Evaluate a python string and display the results as a web page.
Args: Args:
s: The string to evaluate. s: The string to evaluate.
quiet: Don't show the output in a new tab.
""" """
try: try:
r = eval(s) r = eval(s)
out = repr(r) out = repr(r)
except Exception: except Exception:
out = traceback.format_exc() out = traceback.format_exc()
qutescheme.pyeval_output = out qutescheme.pyeval_output = out
tabbed_browser = objreg.get('tabbed-browser', scope='window', if quiet:
window='last-focused') log.misc.debug("pyeval output: {}".format(out))
tabbed_browser.openurl(QUrl('qute:pyeval'), newtab=True) else:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window='last-focused')
tabbed_browser.openurl(QUrl('qute:pyeval'), newtab=True)