From fd89d45dfe14cb1a84ef126b0983bbcc09947d66 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 17 Oct 2013 12:38:32 +0000 Subject: [PATCH] [0.2.x] fixed : IPython integrations bugs git-svn-id: https://pykd.svn.codeplex.com/svn@85811 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/python/pymod.cpp | 10 +++++++--- pykd/win/dbgio.h | 15 +++++++++++++++ snippets/ipython.py | 10 ++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/pykd/python/pymod.cpp b/pykd/python/pymod.cpp index be10781..c02d8d6 100644 --- a/pykd/python/pymod.cpp +++ b/pykd/python/pymod.cpp @@ -135,9 +135,13 @@ BOOST_PYTHON_MODULE( pykd ) // Python debug output console helper classes python::class_( "dout", "dout", python::no_init ) - .def( "write", &DbgOut::write ); - python::class_( "dout", "dout", python::no_init ) - .def( "write", &DbgErr::write ); + .def( "write", &DbgOut::write ) + .def( "flush", &DbgOut::flush ) + .add_property( "encoding", &DbgOut::encoding ); + python::class_( "derr", "derr", python::no_init ) + .def( "write", &DbgErr::write ) + .def( "flush", &DbgOut::flush ) + .add_property( "encoding", &DbgErr::encoding ); python::class_( "din", "din", python::no_init ) .def( "readline", &DbgIn::readline ) .add_property( "encoding", &DbgIn::encoding ); diff --git a/pykd/win/dbgio.h b/pykd/win/dbgio.h index b5f412d..121b143 100644 --- a/pykd/win/dbgio.h +++ b/pykd/win/dbgio.h @@ -17,6 +17,13 @@ public: dprint( str ); } + void flush() { + } + + std::string + encoding() { + return "ascii"; + } }; /////////////////////////////////////////////////////////////////////////////// @@ -30,6 +37,14 @@ public: { eprint( str ); } + + void flush() { + } + + std::string + encoding() { + return "ascii"; + } }; /////////////////////////////////////////////////////////////////////////////// diff --git a/snippets/ipython.py b/snippets/ipython.py index e07ac04..630890f 100644 --- a/snippets/ipython.py +++ b/snippets/ipython.py @@ -1,14 +1,20 @@ from IPython.config.loader import Config from IPython.terminal.embed import InteractiveShellEmbed -from pykd import * + +from IPython.terminal.interactiveshell import TerminalInteractiveShell + +import pykd cfg = Config() cfg.InteractiveShell.colors = 'NoColor' +cfg.InteractiveShell.readline_use = False +cfg.InteractiveShell.autoindent = True + cfg.PromptManager.in_template = 'In <\\#>: ' cfg.PromptManager.in2_template = ' .\\D.: ' cfg.PromptManager.out_template = 'Out<\\#>: ' ipshell = InteractiveShellEmbed(config=cfg) -ipshell() +ipshell() \ No newline at end of file