From 826c13db98e79e182e4e9106678a934b71d2241d Mon Sep 17 00:00:00 2001 From: desvox Date: Sun, 5 Aug 2018 18:19:29 -0500 Subject: [PATCH] Improve developer console. --- clients/urwid/main.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 1df3d8f..665bb41 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -23,11 +23,14 @@ Please mail me (~desvox) for feedback and for any of your from network import BBJ, URLError from string import punctuation from datetime import datetime +from sys import argv, version from time import time, sleep from getpass import getpass from subprocess import call from random import choice -from sys import argv +from code import interact +import rlcompleter +import readline import tempfile import urwid import json @@ -2240,16 +2243,9 @@ class ActionBox(urwid.ListBox): elif keyl == "f12": app.loop.stop() call("clear", shell=True) - try: - line = input("(REPL)> ") - while line: - try: - print(eval(line)) - except BaseException as E: - print(E) - line = input("(REPL)> ") - except EOFError: - pass + readline.set_completer(rlcompleter.Completer().complete) + readline.parse_and_bind("tab: complete") + interact(banner=version + "\n(BBJ Interactive Console)", local=globals()) app.loop.start() elif app.mode == "thread" and not app.window_split and not overlay: