X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPyConsole%2FPyConsole_Console.cxx;h=a3991bf88a8885103e52a684776b8716e737f344;hb=949661e3432745e77dfc32ac83ee7d06c7e57ced;hp=a14eca1d0c976acb9dff9d577030187b23421e8a;hpb=627194285d9b5354291d3a442b68b8740f114eda;p=modules%2Fgui.git diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index a14eca1d0..a3991bf88 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -248,6 +248,10 @@ void PyConsole_Console::contextMenuPopup( QMenu* menu ) menu->addAction( myActions[SelectAllId] ); menu->addSeparator(); menu->addAction( myActions[DumpCommandsId] ); + if ( !myEditor->isLogging() ) + menu->addAction( myActions[StartLogId] ); + else + menu->addAction( myActions[StopLogId] ); Qtx::simplifySeparators( menu ); @@ -269,6 +273,8 @@ void PyConsole_Console::setMenuActions( const int flags ) myActions[ClearId]->setVisible( flags & ClearId ); myActions[SelectAllId]->setVisible( flags & SelectAllId ); myActions[DumpCommandsId]->setVisible( flags & DumpCommandsId ); + myActions[StartLogId]->setVisible( flags & StartLogId ); + myActions[StopLogId]->setVisible( flags & StopLogId ); } /*! @@ -284,6 +290,8 @@ int PyConsole_Console::menuActions() const ret = ret | ( myActions[ClearId]->isVisible() ? ClearId : 0 ); ret = ret | ( myActions[SelectAllId]->isVisible() ? SelectAllId : 0 ); ret = ret | ( myActions[DumpCommandsId]->isVisible() ? DumpCommandsId : 0 ); + ret = ret | ( myActions[StartLogId]->isVisible() ? StartLogId : 0 ); + ret = ret | ( myActions[StopLogId]->isVisible() ? StopLogId : 0 ); return ret; } @@ -318,6 +326,16 @@ void PyConsole_Console::createActions() a->setStatusTip( tr( "EDIT_DUMPCOMMANDS_CMD" ) ); connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( dump() ) ); myActions.insert( DumpCommandsId, a ); + + a = new QAction( tr( "EDIT_STARTLOG_CMD" ), this ); + a->setStatusTip( tr( "EDIT_STARTLOG_CMD" ) ); + connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( startLog() ) ); + myActions.insert( StartLogId, a ); + + a = new QAction( tr( "EDIT_STOPLOG_CMD" ), this ); + a->setStatusTip( tr( "EDIT_STOPLOG_CMD" ) ); + connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( stopLog() ) ); + myActions.insert( StopLogId, a ); } /*! @@ -332,6 +350,23 @@ 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.