From: vsr Date: Wed, 30 Nov 2016 09:49:25 +0000 (+0300) Subject: Add function to initialize root data object for "light" Python module. X-Git-Tag: V8_2_0rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bee8b4ae39a9bdb5f4ccfa310a5519f0e1115c43;p=modules%2Fgui.git Add function to initialize root data object for "light" Python module. --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index e00419798..67c57f31d 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -3319,6 +3319,36 @@ QList SalomePyQt::neighbourViews( const int id ) } +/*! + \fn void SalomePyQt::createRoot(); + \brief Initialize root data object. + + Does nothing if root is already initialized. +*/ + +void SalomePyQt::createRoot() +{ + class TEvent: public SALOME_Event + { + public: + TEvent() {} + virtual void Execute() + { + SALOME_PYQT_ModuleLight* module = dynamic_cast( getActiveModule() ); + if ( module ) { + SALOME_PYQT_DataModelLight* dm = + dynamic_cast( module->dataModel() ); + if ( dm ) + dm->getRoot(); + } + else { + if ( verbose() ) printf( "SalomePyQt.createRoot() function is not supported for the current module.\n" ); + } + } + }; + ProcessVoidEvent( new TEvent() ); +} + /*! \fn QString SalomePyQt::createObject( const QString& parent ); \brief Create empty data object diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 26dcda505..4194fa3b6 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -183,6 +183,7 @@ public: static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ); static QString getExistingDirectory( QWidget*, const QString&, const QString& ); + static void createRoot(); static QString createObject( const QString& parent = QString() ); static QString createObject( const QString&, const QString&, const QString&, const QString& = QString() ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 90f840faa..c481c2444 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -285,6 +285,7 @@ public: static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ; static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ; + static void createRoot() /ReleaseGIL/ ; static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ; static QString createObject( const QString&, const QString&,