X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPyConsole%2FPyConsole_Console.cxx;h=5ec6eb57e07d45cf0890d7f06580052c7516b1ae;hb=1c1e0526d452336651ccecf48deb5d8227ecdd47;hp=a3991bf88a8885103e52a684776b8716e737f344;hpb=e2a96fd9d3d88f2c3ab6cf63a08befb6d5957fbf;p=modules%2Fgui.git diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index a3991bf88..5ec6eb57e 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -52,18 +52,15 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp ) : QWidget( parent ) { - // create python interpreter - myInterp = interp; - if ( !myInterp ) - myInterp = new PyConsole_Interp(); + PyConsole_Interp* anInterp = interp ? interp : new PyConsole_Interp(); // initialize Python interpretator - myInterp->initialize(); + anInterp->initialize(); // create editor console QVBoxLayout* lay = new QVBoxLayout( this ); lay->setMargin( 0 ); - myEditor = new PyConsole_Editor( myInterp, this ); + myEditor = new PyConsole_Editor( anInterp, this ); char* synchronous = getenv("PYTHON_CONSOLE_SYNC"); if (synchronous && atoi(synchronous)) { @@ -78,8 +75,8 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp /** * Protected constructor. */ -PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* i, PyConsole_Editor* e) - : QWidget (parent), myEditor(e), myInterp(i) +PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* /*i*/, PyConsole_Editor* e ) + : QWidget (parent), myEditor(e) {} /*! @@ -91,6 +88,11 @@ PyConsole_Console::~PyConsole_Console() { } +PyConsole_Interp* PyConsole_Console::getInterp() const +{ + return myEditor ? myEditor->getInterp() : 0; +} + /*! \brief Execute python command in the interpreter. \param command string with command and arguments @@ -373,21 +375,18 @@ void PyConsole_Console::stopLog() * @param parent * @param interp */ -PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_EnhInterp* interp) - : PyConsole_Console(parent, interp, 0) +PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp ) + : PyConsole_Console( parent, interp, 0 ) { - // create python interpreter - myInterp = interp; - if ( !myInterp ) - myInterp = new PyConsole_EnhInterp(); + PyConsole_Interp* anInterp = interp ? interp : new PyConsole_EnhInterp(); // initialize Python interpretator - myInterp->initialize(); + anInterp->initialize(); // create editor console QVBoxLayout* lay = new QVBoxLayout( this ); lay->setMargin( 0 ); - myEditor = new PyConsole_EnhEditor( static_cast(myInterp), this ); + myEditor = new PyConsole_EnhEditor( anInterp, this ); char* synchronous = getenv("PYTHON_CONSOLE_SYNC"); if (synchronous && atoi(synchronous)) {