-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SUIT_Selector(mgr, pymod), myPyModule(pymod)
{
MESSAGE("constructor");
+ myLocalEntries.clear();
+ mySelectedList.clear();
+ myEntries.clear();
+ myModifiedTime = 0;
if (myPyModule)
{
connect(myPyModule, SIGNAL(localSelectionChanged()), this, SLOT(onSelectionChanged()));
MESSAGE("destructor");
}
+/*!
+ \brief Reset selection internally. Used on close study.
+ */
+void SALOME_PYQT_Selector::clear()
+{
+ MESSAGE("clear");
+ myLocalEntries.clear();
+ mySelectedList.clear();
+ myEntries.clear();
+}
+
/*!
\brief Get Python module interface instance.
\return a pointer to the Python module interface instance.
MESSAGE("getSelection");
if (mySelectedList.count() == 0)
{
+ MESSAGE("mySelectedList.count(): " << mySelectedList.count() << " myLocalEntries.size(): "<< myLocalEntries.size());
SALOME_PYQT_Selector* that = (SALOME_PYQT_Selector*) this; // because of const...
for (int i = 0; i < myLocalEntries.size(); i++)
{
SALOME_PYQT_BorrowedDataObjectLight *obj = new SALOME_PYQT_BorrowedDataObjectLight(myLocalEntries[i]);
#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject)aSObj = new SALOME_InteractiveObject
- ( obj->entry().toLatin1().constData(),
+ ( obj->entry().toUtf8().constData(),
obj->componentDataType().toLatin1().constData(),
- obj->name().toLatin1().constData() );
+ obj->name().toUtf8().constData() );
LightApp_DataOwner* owner = new LightApp_DataOwner(aSObj);
#else
LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() );
if (!myPyModule)
return;
- if (myEntries.count() == 0 || myModifiedTime < myPyModule->getModifiedTime())
- fillEntries(myEntries);
-
-// DataObjectList objList;
-// for (SUIT_DataOwnerPtrList::const_iterator it = theList.begin(); it != theList.end(); ++it)
-// {
-// const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>((*it).operator->());
-// if (owner && myEntries.contains(owner->entry()))
-// objList.append(myEntries[owner->entry()]);
-// }
-//
-// myPyModule->setSelected(objList);
+ myEntries.clear();
+ for (SUIT_DataOwnerPtrList::const_iterator it = theList.begin(); it != theList.end(); ++it)
+ {
+ const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>((*it).operator->());
+ if (owner)
+ {
+ QString entry = owner->entry();
+ myEntries.append(entry);
+ MESSAGE("Selected: "<< entry.toStdString());
+ }
+ }
+ fillEntries(myEntries);
mySelectedList.clear();
}
\brief Fill map of the data objects currently shown in the Object Browser.
\param entries map to be filled
*/
-void SALOME_PYQT_Selector::fillEntries(QMap<QString, LightApp_DataObject*>& entries)
+void SALOME_PYQT_Selector::fillEntries(QStringList& entries)
{
MESSAGE("fillEntries");
- entries.clear();
-
if (!myPyModule)
return;
-
-// for (SUIT_DataObjectIterator it(myPyModule->root(), SUIT_DataObjectIterator::DepthLeft); it.current(); ++it)
-// {
-// LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>(it.current());
-// if (obj)
-// entries.insert(obj->entry(), obj);
-// }
-
+ myPyModule->setSelected(entries);
setModified();
}