Re-direct help() output to console
Keeps a copy of stdin as well, so that re-assigning this in the python window does't close the output Fixes https://gitlab.com/kicad/code/kicad/issues/8047
This commit is contained in:
parent
8d65663566
commit
76a6177eb7
|
@ -907,9 +907,17 @@ class KiCadEditorFrame(KiCadPyFrame):
|
||||||
class KiCadEditorNotebookFrame(KiCadEditorFrame):
|
class KiCadEditorNotebookFrame(KiCadEditorFrame):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
"""Create EditorNotebookFrame instance."""
|
"""Create EditorNotebookFrame instance."""
|
||||||
|
|
||||||
self.notebook = None
|
self.notebook = None
|
||||||
KiCadEditorFrame.__init__(self, parent)
|
KiCadEditorFrame.__init__(self, parent)
|
||||||
|
|
||||||
if self.notebook:
|
if self.notebook:
|
||||||
|
"""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
|
||||||
|
|
||||||
dispatcher.connect(receiver=self._editorChange,
|
dispatcher.connect(receiver=self._editorChange,
|
||||||
signal='EditorChange', sender=self.notebook)
|
signal='EditorChange', sender=self.notebook)
|
||||||
|
|
||||||
|
@ -935,6 +943,7 @@ class KiCadEditorNotebookFrame(KiCadEditorFrame):
|
||||||
self.setEditor(self.crust.editor)
|
self.setEditor(self.crust.editor)
|
||||||
self.crust.editor.SetFocus()
|
self.crust.editor.SetFocus()
|
||||||
|
|
||||||
|
|
||||||
def _editorChange(self, editor):
|
def _editorChange(self, editor):
|
||||||
"""Editor change signal receiver."""
|
"""Editor change signal receiver."""
|
||||||
if not self:
|
if not self:
|
||||||
|
|
Loading…
Reference in New Issue