Salome HOME
projects
/
modules
/
gui.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'origin/master'
[modules/gui.git]
/
src
/
PyConsole
/
PyConsole_Editor.cxx
diff --git
a/src/PyConsole/PyConsole_Editor.cxx
b/src/PyConsole/PyConsole_Editor.cxx
index 66aaf5b9b72b12f3e4cf30ad04dbc512a2cfa989..2311b58d46bb29a3e2b48be8b4b7cd2020572401 100644
(file)
--- a/
src/PyConsole/PyConsole_Editor.cxx
+++ b/
src/PyConsole/PyConsole_Editor.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
5
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-113,6
+113,22
@@
#include <QTextStream>
#include <QChar>
#include <QTextStream>
#include <QChar>
+//VSR: uncomment below macro to support unicode text properly in SALOME
+// current commented out due to regressions
+//#define PAL22528_UNICODE
+
+namespace
+{
+ QString fromUtf8( const char* txt )
+ {
+#ifdef PAL22528_UNICODE
+ return QString::fromUtf8( txt );
+#else
+ return QString( txt );
+#endif
+ }
+}
+
static QString READY_PROMPT = ">>> ";
static QString DOTS_PROMPT = "... ";
static QString READY_PROMPT = ">>> ";
static QString DOTS_PROMPT = "... ";
@@
-140,8
+156,8
@@
void staticCallbackStdout( void* data, char* c )
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
- e->putLog(
QString::
fromUtf8(c) );
- QApplication::postEvent( e, new PrintEvent(
QString::
fromUtf8(c), false ) );
+ e->putLog( fromUtf8(c) );
+ QApplication::postEvent( e, new PrintEvent( fromUtf8(c), false ) );
}
}
}
}
@@
-149,8
+165,8
@@
void staticCallbackStderr( void* data, char* c )
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
- e->putLog(
QString::
fromUtf8(c) );
- QApplication::postEvent( e, new PrintEvent(
QString::
fromUtf8(c), true ) );
+ e->putLog( fromUtf8(c) );
+ QApplication::postEvent( e, new PrintEvent( fromUtf8(c), true ) );
}
}
}
}
@@
-191,16
+207,20
@@
PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp,
/*!
\brief Destructor.
/*!
\brief Destructor.
-
- Does nothing for the moment.
*/
PyConsole_Editor::~PyConsole_Editor()
{
*/
PyConsole_Editor::~PyConsole_Editor()
{
- myInterp->destroy();
- delete myInterp;
myInterp = 0;
}
myInterp = 0;
}
+/*!
+ \brief Get Python interpreter
+*/
+PyConsole_Interp* PyConsole_Editor::getInterp() const
+{
+ return myInterp;
+}
+
/*!
\brief Get synchronous mode flag value.
/*!
\brief Get synchronous mode flag value.
@@
-396,14
+416,21
@@
void PyConsole_Editor::execAndWait( const QString& command )
return;
// create new event loop
return;
// create new event loop
- myEventLoop = new QEventLoop( this );
+ bool sync = isSync();
+ if ( !sync ) {
+ myEventLoop = new QEventLoop( this );
+ }
+
// execute command
exec( command );
// execute command
exec( command );
- // run event loop
- myEventLoop->exec();
- // delete event loop after command is processed
- delete myEventLoop;
- myEventLoop = 0;
+
+ if ( !sync ) {
+ // run event loop
+ myEventLoop->exec();
+ // delete event loop after command is processed
+ delete myEventLoop;
+ myEventLoop = 0;
+ }
}
/*!
}
/*!