From: vsr Date: Mon, 23 Oct 2006 13:25:58 +0000 (+0000) Subject: Implement access to the LogWindow from the Python modules: X-Git-Tag: V3_2_3pre1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a32a301fe5ab5baab0e30bb74b1d297e1069bab0;p=modules%2Fgui.git Implement access to the LogWindow from the Python modules: - show log messages window for the Python modules by default - provide method message() to add message to the window --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 56bb1a755..d2e912610 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -650,8 +650,7 @@ void SALOME_PYQT_Module::init( CAM_Application* app ) // ... first put default values myWindowsMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); myWindowsMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); - // VSR: LogWindow is not yet implemented - // myWindowsMap.insert( SalomeApp_Application::WT_LogWindow, Qt::DockBottom ); + myWindowsMap.insert( SalomeApp_Application::WT_LogWindow, Qt::DockBottom ); if(PyObject_HasAttrString(myModule , "windows")){ PyObjWrapper res1( PyObject_CallMethod( myModule, "windows", "" ) ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index d26f9b5a9..820f12a53 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -39,6 +39,7 @@ #include "LightApp_SelectionMgr.h" #include "OB_Browser.h" #include "QtxAction.h" +#include "LogWindow.h" using namespace std; @@ -1542,3 +1543,26 @@ void SalomePyQt::addPreferenceProperty( const int id, }; ProcessVoidEvent( new TEvent( id, prop, idx, var) ); } + +/*! + SalomePyQt::message + Puts the message to the Log output window + */ +void SalomePyQt::message( const QString& msg, bool addSeparator ) +{ + class TEvent: public SALOME_Event { + QString myMsg; + bool myAddSep; + public: + TEvent( const QString& msg, bool addSeparator ) + : myMsg( msg ), myAddSep( addSeparator ) {} + virtual void Execute() { + if ( SalomeApp_Application* anApp = getApplication() ) { + LogWindow* lw = anApp->logWindow(); + if ( lw ) + lw->putMessage( myMsg, myAddSep ); + } + } + }; + ProcessVoidEvent( new TEvent( msg, addSeparator ) ); +} diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 5d908ce6e..03e988dcd 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -175,6 +175,8 @@ public: const QString&, const int, const QVariant& ); + + static void message( const QString&, bool = true ); }; #endif // SALOME_PYQT_H diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 73772408d..a8d6fdd6e 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -161,4 +161,6 @@ public: const QString&, const int, const QVariant& ); + + static void message( const QString&, bool = true ); }; diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip index 1c202ebe1..77b783746 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip @@ -161,4 +161,6 @@ public: const QString&, const int, const QVariant& ) /ReleaseGIL/ ; + + static void message( const QString&, bool = true ) /ReleaseGIL/ ; };