]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Add method to Python API (SalomePyQt) to register module in the study tree V9_6_0a1
authorvsr <vsr@opencascade.com>
Tue, 29 Sep 2020 11:03:15 +0000 (14:03 +0300)
committervsr <vsr@opencascade.com>
Tue, 29 Sep 2020 11:03:15 +0000 (14:03 +0300)
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip

index 45deaf3529588560967e318e32116d07c0f47e5f..04b9bece839c9872e70df3159a1eda7a086b8647 100644 (file)
@@ -942,6 +942,28 @@ bool SalomePyQt::activateModule( const QString& modName )
   return ProcessEvent( new TActivateModuleEvent( modName ) );
 }
 
+/*!
+  \fn void SalomePyQt::registerModule( const QString& modName);
+  \brief Registers module in the study tree
+*/
+
+void SalomePyQt::registerModule( const QString& modName)
+{
+  class TEvent: public SALOME_Event
+  {
+    QString myName;
+  public:
+    TEvent(const QString& name): myName(name) {}
+    virtual void Execute()
+    {
+      if ( LightApp_Application* anApp = getApplication() ) {
+       anApp->desktop()->emitMessage(QString("register_module_in_study/%1").arg(myName));
+      }
+    }
+  };
+  ProcessVoidEvent( new TEvent(modName) );
+}
+
 /*!
   \brief Update an Object Browser of the study.
 */
index 89f312ab0c357ab82118112ff48ab438eed0e886..34089b95b2eb1219c48fe6ce2beb39e86ef535e2 100644 (file)
@@ -196,6 +196,7 @@ public:
   static const QString     getActiveComponent();
   static PyObject*         getActivePythonModule();
   static bool              activateModule( const QString& );
+  static void              registerModule( const QString& );
   static void              updateObjBrowser();
 
   static void              putInfo( const QString&, const int = 0 );
index f78e4e40987e3d239e0eb899e139f403d9084261..ed20aafac82d3e1ce59243845255748bee18013e 100644 (file)
@@ -307,6 +307,7 @@ public:
   static const QString     getActiveComponent() /ReleaseGIL/ ;
   static SIP_PYOBJECT      getActivePythonModule() /ReleaseGIL/ ;
   static bool              activateModule( const QString& ) /ReleaseGIL/ ;
+  static void              registerModule( const QString& ) /ReleaseGIL/ ;
   static void              updateObjBrowser() /ReleaseGIL/ ;
 
   static void              putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;