]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Implement access to the LogWindow from the Python modules:
authorvsr <vsr@opencascade.com>
Mon, 23 Oct 2006 13:25:58 +0000 (13:25 +0000)
committervsr <vsr@opencascade.com>
Mon, 23 Oct 2006 13:25:58 +0000 (13:25 +0000)
- show log messages window for the Python modules by default
- provide method message() to add message to the window

src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip
src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip

index 56bb1a7553afc367b104e885cebb51ce5ffd0817..d2e912610d356841ed438e5e0218ad0b3dd8b3f3 100644 (file)
@@ -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", "" ) );
index d26f9b5a9f28a54ac35cc414ec1e6c5864b6e5cc..820f12a530d8d421dbe555943a4753971bac1fe2 100644 (file)
@@ -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 ) );
+}
index 5d908ce6ec2082f233ba59ae78a2dcd1e94e40e8..03e988dcd7cd5beeefa4de7cb8ca20ec46453860 100644 (file)
@@ -175,6 +175,8 @@ public:
                                                  const QString&,
                                                  const int,
                                                  const QVariant& );
+
+  static void              message( const QString&, bool = true );
 };
 
 #endif // SALOME_PYQT_H
index 73772408d66c9986f227e399fdc6733a194ecf39..a8d6fdd6e608ca679587de30f88a846adb1d4f54 100644 (file)
@@ -161,4 +161,6 @@ public:
                                                   const QString&,
                                                  const int, 
                                                  const QVariant& );
+
+  static void              message( const QString&, bool = true );
 };
index 1c202ebe16df5f9e6a149bd727dc2fc61f2993c1..77b7837464711a3b744fc7141d6af0d0b68e1c41 100644 (file)
@@ -161,4 +161,6 @@ public:
                                                   const QString&, 
                                                  const int, 
                                                  const QVariant& ) /ReleaseGIL/ ;
+
+  static void              message( const QString&, bool = true ) /ReleaseGIL/ ;
 };