Salome HOME
Porting to ParaView 5.8
[modules/gui.git] / src / SALOME_PYQT / SALOME_PYQT_GUILight / SALOME_PYQT_ModuleLight.cxx
index 6b17d8d0941d806d97dde44c3d35790ec99bc504..92fda689fc21d19b37f128857478b1687d75ec28 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,8 @@
 // File   : SALOME_PYQT_ModuleLight.cxx
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
-#include "SALOME_PYQT_DataModelLight.h"
 #include "SALOME_PYQT_ModuleLight.h"
+#include "SALOME_PYQT_DataModelLight.h"
 #include "SALOME_PYQT_PyModule.h"
 #include "SALOME_PYQT_Selector.h"
 
@@ -63,7 +63,7 @@
 // and to get C API from sip : sipBuildResult for example
 //
 
-#define INIT_FUNCTION initSalomePyQtGUILight
+#define INIT_FUNCTION PyInit_SalomePyQtGUILight
 #if defined(SIP_STATIC_MODULE)
 extern "C" void INIT_FUNCTION();
 #else
@@ -180,6 +180,8 @@ void SALOME_PYQT_ModuleLight::onModelClosed()
 {
   // call helper
   myHelper->modelClosed(application()->activeStudy());
+  if (mySelector)
+    mySelector->clear();
   LightApp_Module::onModelClosed();
 }
 
@@ -605,31 +607,46 @@ SALOME_PYQT_DataObjectLight* SALOME_PYQT_ModuleLight::findObject( const QString&
   return obj;
 }
 
+/*!
+  \brief not used yet
+*/
 void SALOME_PYQT_ModuleLight::getSelected( DataObjectList& ) const
 {
   MESSAGE("getSelected");
 }
 
-unsigned long SALOME_PYQT_ModuleLight::getModifiedTime() const
-{
-  MESSAGE("getModifiedTime");
-
-}
-
-
-SUIT_DataObject* SALOME_PYQT_ModuleLight::root() const
-{
-  MESSAGE("root");
-
-}
+/*!
+  \brief not used yet
+*/
+//unsigned long SALOME_PYQT_ModuleLight::getModifiedTime() const
+//{
+//  MESSAGE("getModifiedTime");
+//  return 0;
+//}
 
+/*!
+  \brief not used yet
+*/
+//SUIT_DataObject* SALOME_PYQT_ModuleLight::root() const
+//{
+//  MESSAGE("root");
+//  return NULL;
+//}
 
+/*!
+  \brief Used to notify a Python light module of a modification of selection in study (propagation of a remote selection)
+  \param list of study entries
+*/
 void SALOME_PYQT_ModuleLight::setSelected( const QStringList& entries, const bool isUnused)
 {
   MESSAGE("setSelected");
   return myHelper->selectionUpdated(entries);
 }
 
+/*!
+  \brief called by Python module to notify a list of study entries locally selected (for selection propagation)
+  \param list of study entries
+*/
 void SALOME_PYQT_ModuleLight::setLocalSelected(const QStringList & entries)
 {
   MESSAGE("setLocalSelected");
@@ -641,3 +658,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);
+}