From: vsr Date: Tue, 29 Sep 2020 11:03:15 +0000 (+0300) Subject: Add method to Python API (SalomePyQt) to register module in the study tree X-Git-Tag: V9_6_0a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=72dda148cdce2dae82d0820d495d994e3f7ef8bb;p=modules%2Fgui.git Add method to Python API (SalomePyQt) to register module in the study tree --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 45deaf352..04b9bece8 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -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. */ diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 89f312ab0..34089b95b 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -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 ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index f78e4e409..ed20aafac 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -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/ ;