From: Paul RASCLE Date: Mon, 20 Mar 2017 19:47:00 +0000 (+0100) Subject: PyQt methods for enabling or disabling PyQt_Selector X-Git-Tag: SHAPER_2.7.0_WIN~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=47ed4031ffa02375102b8ad11a24a17e6bec07f7;p=modules%2Fgui.git PyQt methods for enabling or disabling PyQt_Selector --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx index 9e53d0350..29620a41a 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx @@ -656,3 +656,19 @@ void SALOME_PYQT_ModuleLight::setLocalSelected(const QStringList & entries) emit localSelectionChanged(); } +void SALOME_PYQT_ModuleLight::enableSelector() +{ + MESSAGE("enableSelector"); + if (!mySelector) + { + mySelector = new SALOME_PYQT_Selector(this, this->getApp()->selectionMgr()); + } + mySelector->setEnabled(true); +} + +void SALOME_PYQT_ModuleLight::disableSelector() +{ + MESSAGE("disableSelector"); + if (mySelector) + mySelector->setEnabled(false); +} diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.h b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.h index 02fd4ae3a..8cb5393a9 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.h @@ -98,6 +98,8 @@ public: QStringList getChildren( const QString&, const bool = false ) const; + void enableSelector(); + void disableSelector(); void setLocalSelected(const QStringList &); void getSelected( DataObjectList& ) const; unsigned long getModifiedTime() const; diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 53c374059..4748bde69 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -586,6 +586,50 @@ void SalomePyQt::setSelection( const QStringList& entryList) return ProcessVoidEvent( new TSetSelectionEvent(entryList) ); } +/*! + \fn void SalomePyQt::enableSelector(); + \brief enable PyQt_Selector (on module activation, for instance) +*/ + +class TEnableSelectorEvent: public SALOME_Event +{ +public: + TEnableSelectorEvent() {} + virtual void Execute() + { + SALOME_PYQT_ModuleLight* module = dynamic_cast( getActiveModule() ); + if ( !module ) return; + module->enableSelector(); + } +}; +void SalomePyQt::enableSelector() +{ + return ProcessVoidEvent( new TEnableSelectorEvent() ); +} + + +/*! + \fn void SalomePyQt::disableSelector(); + \brief disable PyQt_Selector (on module activation, for instance) +*/ + +class TdisableSelectorEvent: public SALOME_Event +{ +public: + TdisableSelectorEvent() {} + virtual void Execute() + { + SALOME_PYQT_ModuleLight* module = dynamic_cast( getActiveModule() ); + if ( !module ) return; + module->disableSelector(); + } +}; +void SalomePyQt::disableSelector() +{ + return ProcessVoidEvent( new TdisableSelectorEvent() ); +} + + /*! \fn void SalomePyQt::putInfo( const QString& msg, const int sec ); \brief Put an information message to the current application's diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 213d86488..d31a8600f 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -168,6 +168,8 @@ public: static QMenu* getPopupMenu( const MenuName ); static QMenu* getPopupMenu( const QString& ); static QTreeView* getObjectBrowser(); + static void enableSelector(); + static void disableSelector(); static SALOME_Selection* getSelection(); static void setSelection( const QStringList& ); static int getStudyId(); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 637bbd280..59309bcfd 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -270,6 +270,8 @@ public: static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ; static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ; static QTreeView* getObjectBrowser() /ReleaseGIL/ ; + static void enableSelector() /ReleaseGIL/ ; + static void disableSelector() /ReleaseGIL/ ; static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ; static void setSelection( const QStringList& ) /ReleaseGIL/ ; static int getStudyId() /ReleaseGIL/ ;