From: vsr Date: Tue, 29 Nov 2016 12:44:03 +0000 (+0300) Subject: Add parameters() function to SalomePyQt API to get list of parameters stored in given... X-Git-Tag: V8_2_0rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e3f7d23050a100784c94192adc9bc802bae1d873;p=modules%2Fgui.git Add parameters() function to SalomePyQt API to get list of parameters stored in given resources section. --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 0d91d941d..e00419798 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -1503,6 +1503,50 @@ bool SalomePyQt::hasSetting( const QString& section, const QString& name ) return ProcessEvent( new THasSettingEvent( section, name ) ); } +/*! + \fn QStringList SalomePyQt::parameters( const QString& section ); + \brief Get names of preference items stored within the given section. + \param section resources file section's name + \return \c list of preferences items +*/ + +/*! + \fn QStringList SalomePyQt::parameters( const QStringList& section ); + \brief Get names of preference items stored within the given section. + \param section resources file section's name + \return \c list of preferences items +*/ + +class TParametersEvent: public SALOME_Event +{ +public: + typedef QStringList TResult; + TResult myResult; + QStringList mySection; + TParametersEvent( const QString& section ) + { + mySection << section; + } + TParametersEvent( const QStringList& section ) + : mySection( section ) + {} + virtual void Execute() + { + if ( SUIT_Session::session() ) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + myResult = resMgr->parameters( mySection ); + } + } +}; +QStringList SalomePyQt::parameters( const QString& section ) +{ + return ProcessEvent( new TParametersEvent( section ) ); +} +QStringList SalomePyQt::parameters( const QStringList& section ) +{ + return ProcessEvent( new TParametersEvent( section ) ); +} + /*! \fn QString SalomePyQt::getFileName( QWidget* parent, const QString& initial, diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index f508b046f..26dcda505 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -262,6 +262,8 @@ public: static QByteArray byteArraySetting( const QString&, const QString&, const QByteArray& = QByteArray() ); static void removeSetting ( const QString&, const QString& ); static bool hasSetting ( const QString&, const QString& ); + static QStringList parameters ( const QString& ); + static QStringList parameters ( const QStringList& ); static int addGlobalPreference( const QString& ); static int addPreference( const QString& ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 662aa4858..90f840faa 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -366,6 +366,8 @@ public: static QByteArray byteArraySetting( const QString&, const QString&, const QByteArray& = QByteArray() ) /ReleaseGIL/ ; static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ; static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ; + static QStringList parameters ( const QString& ) /ReleaseGIL/ ; + static QStringList parameters ( const QStringList& ) /ReleaseGIL/ ; // obsolete static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;