return myHelper->selectionUpdated(entries);
}
-
-//void SALOME_PYQT_ModuleLight::selectionChanged()
-//{
-// MESSAGE("signal selectionChanged");
-//}
-
void SALOME_PYQT_ModuleLight::setLocalSelected(const QStringList & entries)
{
MESSAGE("setLocalSelected");
void PyModuleHelper::selectionUpdated(const QStringList& entries)
{
FuncMsg fmsg( "PyModuleHelper::selectionUpdated()" );
+ MESSAGE("selectionUpdated");
// perform synchronous request to Python event dispatcher
class SelectionReq : public PyInterp_LockRequest
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myHelper( _helper ),
myEntries( _entries )
- {}
+ {
+ MESSAGE("SelectionReq");
+ }
protected:
virtual void execute()
{
+ MESSAGE("execute");
myHelper->internalSelectionUpdated( myEntries );
}
private:
const QStringList& myEntries;
};
- // get sender action
- QAction* action = qobject_cast<QAction*>( sender() );
- if ( !action )
- return;
-
// post request
PyInterp_Dispatcher::Get()->Exec( new SelectionReq( myInterp, this, entries ) );
}
void PyModuleHelper::internalSelectionUpdated(const QStringList& entries)
{
FuncMsg fmsg("--- PyModuleHelper::internalSelectionUpdated()");
+ MESSAGE("internalSelectionUpdated");
// Python interpreter should be initialized and Python module should be imported first
if (!myInterp || !myPyModule)
#endif
if (PyObject_HasAttrString(myPyModule, (char*) "onSelectionUpdated"))
{
+ MESSAGE("call onSelectionUpdated");
PyObjWrapper res(PyObject_CallMethod(myPyModule, (char*) "onSelectionUpdated", (char*) "O", sipList.get()));
if (!res)
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++)
{
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();
}
virtual void setSelection( const SUIT_DataOwnerPtrList& );
private:
- void fillEntries( QMap<QString, LightApp_DataObject*>& );
+ void fillEntries( QStringList& );
private:
QStringList myLocalEntries;
SALOME_PYQT_ModuleLight* myPyModule;
SUIT_DataOwnerPtrList mySelectedList;
- QMap<QString, LightApp_DataObject*> myEntries;
+ QStringList myEntries;
unsigned long myModifiedTime;
};