Prevent help() from blocking terminal

Ensures that the pydoc pager gets re-directed to the PyShell.  Also
keeps a copy of stdin to prevent closure in case of re-assignment

Fixes https://gitlab.com/kicad/code/kicad/issues/8047
This commit is contained in:
Seth Hillbrand 2021-07-12 16:51:32 -07:00
parent 22bdf37fc2
commit 435b1720c3
1 changed files with 6 additions and 0 deletions

View File

@ -108,6 +108,12 @@ class PcbnewPyShell(editor.EditorNotebookFrame):
self.setEditor(self.crust.editor) self.setEditor(self.crust.editor)
self.crust.editor.SetFocus() self.crust.editor.SetFocus()
"""Keep pydoc output on stdout instead of pager and
place the stdout into the editor window """
import pydoc, sys
self._keep_stdin = sys.stdin
pydoc.pager = pydoc.plainpager
self.LoadHistory() self.LoadHistory()
def OnAbout(self, event): def OnAbout(self, event):