Adds prompt_toolkit inputhook using helper func since kwarg was removed

This commit is contained in:
clothespin
2021-03-16 17:44:14 -07:00
parent e6eb75585b
commit 132e890ca7

View File

@@ -3,11 +3,18 @@ import os
from matplotlib import pyplot
from prompt_toolkit import PromptSession
from prompt_toolkit.eventloop.inputhook import set_eventloop_with_inputhook
from prompt_toolkit.history import FileHistory
def inputhook(inputhook_context):
while not inputhook_context.input_is_ready():
pyplot.pause(0.1)
return False
history_file = os.path.join(os.path.expanduser("~"), ".gamestonk_terminal.his")
try:
session = PromptSession(history=FileHistory(history_file), inputhook=pyplot.draw)
session = PromptSession(history=FileHistory(history_file))
set_eventloop_with_inputhook(inputhook)
except Exception as e: # noqa: F841
session = None
raise e