]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
PyQt methods for enabling or disabling PyQt_Selector
authorPaul RASCLE <paul.rascle@edf.fr>
Mon, 20 Mar 2017 19:47:00 +0000 (20:47 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Tue, 21 Mar 2017 13:05:24 +0000 (14:05 +0100)
src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx
src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip

index 9e53d0350ef7e5e232a180645bc2e578e391fe66..29620a41aa05db16bc9cb4fb1625a2a9813f43b3 100644 (file)
@@ -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);
+}
index 02fd4ae3a09f96c3c515860a49aeff396db1b450..8cb5393a9f080ba340636d5a86f8e9673fe9f83e 100644 (file)
@@ -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;
index 53c3740594586c69b32992a8aeb21678299de29a..4748bde6982715b6c778880625545e9b1a41ccf9 100644 (file)
@@ -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<SALOME_PYQT_ModuleLight*>( 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<SALOME_PYQT_ModuleLight*>( 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 
index 213d864887c8ab8249acfa1dbacbb43cae10d0b2..d31a8600fcee4365ef0f0ff845b9534a6afbb556 100644 (file)
@@ -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();
index 637bbd28029620fa3b83225c243556461f171f9b..59309bcfdb0481a4edcd55f08717c6f53a83b678 100644 (file)
@@ -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/ ;