Merge pull request #265 from Alok/add-ptipython

Add ptipython
This commit is contained in:
Andreas Klöckner 2017-08-27 15:54:47 -05:00 committed by GitHub
commit c98b8e7d7b
3 changed files with 22 additions and 1 deletions

View File

@ -1769,6 +1769,8 @@ class DebuggerUI(FrameVarInfoKeeper):
runner = shell.run_bpython_shell
elif CONFIG["shell"] == "ptpython" and shell.HAVE_PTPYTHON:
runner = shell.run_ptpython_shell
elif CONFIG["shell"] == "ptipython" and shell.HAVE_PTIPYTHON:
runner = shell.run_ptipython_shell
elif CONFIG["shell"] == "classic":
runner = shell.run_classic_shell
else:

View File

@ -211,7 +211,7 @@ def edit_config(ui, conf_dict):
shell_info = urwid.Text("This is the shell that will be "
"used when you hit '!'.\n")
shells = ["internal", "classic", "ipython", "bpython", "ptpython"]
shells = ["internal", "classic", "ipython", "bpython", "ptpython", "ptipython"]
known_shell = conf_dict["shell"] in shells
shell_edit = urwid.Edit(edit_text=conf_dict["custom_shell"])
shell_edit_list_item = urwid.AttrMap(shell_edit, "value")

View File

@ -11,6 +11,16 @@ except ImportError:
else:
HAVE_BPYTHON = True
try:
from ptpython.ipython import embed as ptipython_embed
from ptpython.repl import run_config
except ImportError:
HAVE_PTIPYTHON = False
else:
HAVE_PTIPYTHON = True
try:
from ptpython.repl import embed as ptpython_embed, run_config
except ImportError:
@ -237,4 +247,13 @@ def run_ptpython_shell(globals, locals):
configure=run_config)
def run_ptipython_shell(globals, locals):
# Use the default ptpython history
import os
history_filename = os.path.expanduser('~/.ptpython_history')
ptipython_embed(globals.copy(), locals.copy(),
history_filename=history_filename,
configure=run_config)
# vim: foldmethod=marker