Salome HOME
0023313: [CEA 1917] bug_1194_start_log regression
authorvsr <vsr@opencascade.com>
Tue, 9 Aug 2016 12:48:39 +0000 (15:48 +0300)
committervsr <vsr@opencascade.com>
Tue, 9 Aug 2016 12:48:39 +0000 (15:48 +0300)
tools/PyConsole/src/PyConsole_Editor.cxx
tools/PyConsole/src/PyConsole_Editor.h

index 7d540f62f298efc5c2e6cc8d418e9b1a42e7a06b..e177a03ef3589936ecbae07ea77665c7453fff40 100644 (file)
@@ -128,18 +128,20 @@ namespace
 static QString READY_PROMPT = ">>> ";
 static QString DOTS_PROMPT  = "... ";
 
-void staticCallbackStdout( void* data, char* c )
+void PyConsole_CallbackStdout( void* data, char* c )
 {
   if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
     PyConsole_Editor* e = (PyConsole_Editor*)data;
+    e->putLog( fromUtf8(c) );
     QApplication::postEvent( e, new PyConsole_PrintEvent( fromUtf8(c), false ) );
   }
 }
 
-void staticCallbackStderr( void* data, char* c )
+void PyConsole_CallbackStderr( void* data, char* c )
 {
   if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
     PyConsole_Editor* e = (PyConsole_Editor*)data;
+    e->putLog( fromUtf8(c) );
     QApplication::postEvent( e, new PyConsole_PrintEvent( fromUtf8(c), true ) );
   }
 }
@@ -174,8 +176,8 @@ PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp,
   setAcceptRichText( false );
 
   // set callbacks to interpeter
-  myInterp->setvoutcb( staticCallbackStdout, this );
-  myInterp->setverrcb( staticCallbackStderr, this );
+  myInterp->setvoutcb( PyConsole_CallbackStdout, this );
+  myInterp->setverrcb( PyConsole_CallbackStderr, this );
   // print banner
   if ( isShowBanner() )
     addText( banner() );
@@ -1157,7 +1159,6 @@ void PyConsole_Editor::customEvent( QEvent* event )
   case PyConsole_PrintEvent::EVENT_ID:
   {
     PyConsole_PrintEvent* pe = (PyConsole_PrintEvent*)event;
-    putLog( pe->text());
     addText( pe->text(), false, pe->isError() );
     return;
   }
index 774e101af0c46b767ffd3430056945003b875a17..a63e8fcd12fc1672c86e1e4e50d65fe4c3c52f06 100644 (file)
@@ -132,6 +132,8 @@ private:
   QString           myComplAfterPoint;  //!< string on which the results of the dir() are matched
   int               myComplCursorPos;   //!< cursor position when <TAB> is hit
 
+  friend void PyConsole_CallbackStdout( void*, char* );
+  friend void PyConsole_CallbackStderr( void*, char* );
 };
 
 #endif // PYCONSOLE_EDITOR_H