From: omy Date: Mon, 22 Dec 2014 11:13:41 +0000 (+0300) Subject: Added flag to prevent output of command lines to the console. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c64c7b52019356363e723d265fd359392cbb598d;p=modules%2Fgui.git Added flag to prevent output of command lines to the console. --- diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index 0037368ff..91feadfee 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -88,10 +88,11 @@ PyConsole_Console::~PyConsole_Console() \brief Execute python command in the interpreter. \param command string with command and arguments */ -void PyConsole_Console::exec( const QString& command ) +void PyConsole_Console::exec (const QString& command, + const bool shouldPrint) { if ( myEditor ) - myEditor->exec( command ); + myEditor->exec (command, shouldPrint); } /*! diff --git a/src/PyConsole/PyConsole_Console.h b/src/PyConsole/PyConsole_Console.h index 811b396d1..a127cc8e6 100644 --- a/src/PyConsole/PyConsole_Console.h +++ b/src/PyConsole/PyConsole_Console.h @@ -69,7 +69,7 @@ public: bool isShowBanner() const; void setIsShowBanner( const bool ); - void exec( const QString& ); + void exec (const QString&, const bool shouldPrint = true); void execAndWait( const QString& ); virtual bool eventFilter( QObject*, QEvent* ); diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index b4b8f1084..1eb8d51ff 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -383,7 +383,7 @@ void PyConsole_Editor::addText( const QString& str, as if the user typed it manually. \param command python command to be executed */ -void PyConsole_Editor::exec( const QString& command ) +void PyConsole_Editor::exec( const QString& command, const bool shouldPrint ) { if ( isReadOnly() ) { // some interactive command is being executed in this editor... @@ -408,7 +408,8 @@ void PyConsole_Editor::exec( const QString& command ) for ( int i = 0; i < lines.size(); i++ ) { if ( !lines[i].trimmed().isEmpty() ) myHistory.push_back( lines[i] ); - addText( ( i == 0 ? READY_PROMPT : DOTS_PROMPT ) + lines[i], i != 0 ); + if (shouldPrint) + addText( ( i == 0 ? READY_PROMPT : DOTS_PROMPT ) + lines[i], i != 0 ); } // IPAL20182 addText( "", true ); diff --git a/src/PyConsole/PyConsole_Editor.h b/src/PyConsole/PyConsole_Editor.h index 32bb2ca88..4355c99f1 100644 --- a/src/PyConsole/PyConsole_Editor.h +++ b/src/PyConsole/PyConsole_Editor.h @@ -46,7 +46,7 @@ public: virtual void addText( const QString& str, const bool newBlock = false ); bool isCommand( const QString& str ) const; - virtual void exec( const QString& command ); + virtual void exec( const QString& command, const bool shouldPrint = true ); void execAndWait( const QString& command ); bool isSync() const;