X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPyConsole%2FPyConsole_Console.cxx;h=5ec6eb57e07d45cf0890d7f06580052c7516b1ae;hb=1c1e0526d452336651ccecf48deb5d8227ecdd47;hp=f386ebfdb6ee77588d7a0af85fcc0f2df911ce49;hpb=e49ea868e39afd8b5b3d74708997f2b3c705b0b7;p=modules%2Fgui.git diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index f386ebfdb..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 @@ -350,27 +352,41 @@ void PyConsole_Console::updateActions() myActions[SelectAllId]->setEnabled( !myEditor->document()->isEmpty() ); } +/*! + \brief Start python trace logging + \param fileName the path to the log file +*/ +void PyConsole_Console::startLog( const QString& fileName ) +{ + myEditor->startLog( fileName ); +} + +/*! + \brief Stop python trace logging +*/ +void PyConsole_Console::stopLog() +{ + myEditor->stopLog(); +} + /** * Similar to constructor of the base class but using enhanced objects. * TODO: this should really be done in a factory to avoid code duplication. * @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)) {