From: omy Date: Thu, 25 Dec 2014 14:23:24 +0000 (+0300) Subject: Fix for SbmGui_PythonOp to prevent blocking of PyConsole after PyOperation fail. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0cc0fcbff195281d9198cbc66851de1f7f2f0935;p=modules%2Fgui.git Fix for SbmGui_PythonOp to prevent blocking of PyConsole after PyOperation fail. --- diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index 91feadfee..56e994460 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -134,6 +134,27 @@ void PyConsole_Console::setIsSync( const bool on ) myEditor->setIsSync( on ); } +/*! + \brief Get read only flag value. + + \sa setIsReadOnly() + \return True if python console output is in Read-only state. +*/ +bool PyConsole_Console::isReadOnly() const +{ + return myEditor->isReadOnly(); +} + +/*! + \brief Set read only flag value. + + \param on read only mode flag +*/ +void PyConsole_Console::setIsReadOnly( const bool on ) +{ + myEditor->setReadOnly( on ); +} + /*! \brief Get suppress output flag value. diff --git a/src/PyConsole/PyConsole_Console.h b/src/PyConsole/PyConsole_Console.h index a127cc8e6..e58890792 100644 --- a/src/PyConsole/PyConsole_Console.h +++ b/src/PyConsole/PyConsole_Console.h @@ -63,6 +63,9 @@ public: bool isSync() const; void setIsSync( const bool ); + bool isReadOnly() const; + void setIsReadOnly( const bool ); + bool isSuppressOutput() const; void setIsSuppressOutput( const bool ); diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index 1eb8d51ff..3c8d7073a 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -403,7 +403,7 @@ void PyConsole_Editor::exec( const QString& command, const bool shouldPrint ) myCmdInHistory = -1; // print command line by line QString cmd = command; - if ( !cmd.endsWith( "\n" ) ) cmd += "\n"; + if ( shouldPrint && !cmd.endsWith( "\n" ) ) cmd += "\n"; QStringList lines = command.split( "\n" ); for ( int i = 0; i < lines.size(); i++ ) { if ( !lines[i].trimmed().isEmpty() )