]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
[MEDCalc] Show object info (ids) in OB
authorCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 13 Apr 2016 15:13:39 +0000 (17:13 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Fri, 15 Apr 2016 15:31:57 +0000 (17:31 +0200)
13 files changed:
idl/MED_Gen.idl
src/MEDCalc/MEDCalcConstants.hxx
src/MEDCalc/cmp/MED.cxx
src/MEDCalc/cmp/MED.hxx
src/MEDCalc/gui/DatasourceController.cxx
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/ProcessingController.cxx
src/MEDCalc/gui/WorkspaceController.cxx
src/MEDCalc/gui/dialogs/DlgChangeUnderlyingMesh.cxx
src/MEDCalc/gui/dialogs/DlgInterpolateField.cxx
src/MEDCalc/tui/medevents.py
src/MEDCalc/tui/medio.py
src/MEDCalc/tui/medpresentation.py

index 84589339c5daf1036daa01f2051da668894a84d9..5df35be243cb5c841d6dedb614e22a6378528029 100644 (file)
@@ -44,7 +44,8 @@ module MED_ORB
     status registerPresentation(in SALOMEDS::Study study,
                                 in long fieldId,
                                 in string name,
-                                in string label)
+                                in string label,
+                                in long presentationId)
       raises (SALOME::SALOME_Exception);
   };
 };
index 995cb149b149454cd3fbefb6f31802a3b1a2f77b..e9c72abbf40df5967bb247996d38ff6a2450610c 100644 (file)
 
 // This constant strings are used to specify an attribute name for
 // AttributeParameter attributes associated to a SObject
-#define OBJECT_ID              "objectid"
-#define OBJECT_IS_IN_WORKSPACE "isInWorkspace"
+#define IS_IN_WORKSPACE  "isInWorkspace"
+#define SOURCE_ID        "sourceId"
+#define MESH_ID          "meshId"
+//#define FIELD_SERIES_ID  "fieldSeriesId"
+#define FIELD_ID         "fieldId"
+#define PRESENTATION_ID  "presentationId"
+#define IS_PRESENTATION  "isPresentation"
+
 
 static const int NB_TYPE_OF_FIELDS = 4;
 static const char* mapTypeOfFieldLabel[NB_TYPE_OF_FIELDS] =
   {"ON_CELLS", "ON_NODES", "ON_GAUSS_PT", "ON_GAUSS_NE" };
-
-
-// Used by presentations
-#define FIELD_ID "fieldid"
-#define IS_PRESENTATION "ispresentation"
index 6eae6c580fdec128a65011e94ca76c7f900c78ae..c89b152adc73982aa57281517068130c051506e2 100644 (file)
 
 #include <SALOMEDS_SObject.hxx>
 #include <Utils_ExceptHandlers.hxx>
+#include <SalomeApp_Application.h>
 
 #include <string>
+#include <sstream>
 
 /*!
   \brief Constructor
@@ -103,7 +105,7 @@ MED::addDatasourceToStudy(SALOMEDS::Study_ptr study,
       soDatasource->SetAttrString("AttributePixMap", "ICO_DATASOURCE");
       anAttr = studyBuilder->FindOrCreateAttribute(soDatasource, "AttributeParameter");
       aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-      aParam->SetInt(OBJECT_ID, datasourceHandler.id);
+      aParam->SetInt(SOURCE_ID, datasourceHandler.id);
       useCaseBuilder->AppendTo(soDatasource->GetFather(), soDatasource);
 
       // We can add the meshes as children of the datasource
@@ -117,10 +119,8 @@ MED::addDatasourceToStudy(SALOMEDS::Study_ptr study,
         soMesh->SetAttrString("AttributePixMap", "ICO_DATASOURCE_MESH");
         anAttr = studyBuilder->FindOrCreateAttribute(soMesh, "AttributeParameter");
         aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-        aParam->SetInt(OBJECT_ID, meshHandler.id);
-        anAttr = studyBuilder->FindOrCreateAttribute(soMesh, "AttributeParameter");
-        aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-        aParam->SetBool(OBJECT_IS_IN_WORKSPACE, false);
+        aParam->SetInt(MESH_ID, meshHandler.id);
+        aParam->SetBool(IS_IN_WORKSPACE, false);
         useCaseBuilder->AppendTo(soMesh->GetFather(), soMesh);
 
         // We add the field timeseries defined on this mesh, as children of the mesh SObject
@@ -138,10 +138,9 @@ MED::addDatasourceToStudy(SALOMEDS::Study_ptr study,
           soFieldseries->SetAttrString("AttributePixMap", "ICO_DATASOURCE_FIELD");
           anAttr = studyBuilder->FindOrCreateAttribute(soFieldseries, "AttributeParameter");
           aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-          aParam->SetInt(OBJECT_ID, fieldseriesHandler.id);
-          anAttr = studyBuilder->FindOrCreateAttribute(soFieldseries, "AttributeParameter");
-          aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-          aParam->SetBool(OBJECT_IS_IN_WORKSPACE, false);
+          //aParam->SetInt(FIELD_SERIES_ID, fieldseriesHandler.id);
+          aParam->SetInt(FIELD_ID, fieldseriesHandler.id);
+          aParam->SetBool(IS_IN_WORKSPACE, false);
 
           useCaseBuilder->AppendTo(soFieldseries->GetFather(), soFieldseries);
           soFieldseries->UnRegister();
@@ -163,7 +162,8 @@ MED_ORB::status
 MED::registerPresentation(SALOMEDS::Study_ptr study,
                           CORBA::Long fieldId,
                           const char* name,
-                          const char* label)
+                          const char* label,
+                          CORBA::Long presentationId)
 {
   // set exception handler to catch unexpected CORBA exceptions
   Unexpect aCatch(SALOME_SalomeException);
@@ -198,6 +198,7 @@ MED::registerPresentation(SALOMEDS::Study_ptr study,
   aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
   aParam->SetInt(FIELD_ID, fieldId);
   aParam->SetBool(IS_PRESENTATION, true);
+  aParam->SetInt(PRESENTATION_ID, presentationId);
 
   result = MED_ORB::OP_OK;
   return result;
@@ -242,6 +243,80 @@ MED::DumpPython(CORBA::Object_ptr theStudy,
   return aStreamFile._retn();
 }
 
+CORBA::Boolean
+MED::hasObjectInfo()
+{
+  return true;
+}
+
+char*
+MED::getObjectInfo(CORBA::Long studyId, const char* entry)
+{
+  SALOME_NamingService* nameService = SalomeApp_Application::namingService();
+  CORBA::Object_var aSMObject = nameService->Resolve( "/myStudyManager" );
+  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
+  SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
+  SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( entry );
+  SALOMEDS::SObject_var aResultSObj;
+  if (aSObj->ReferencedObject(aResultSObj))
+    aSObj = aResultSObj;
+
+  if (aSObj->_is_nil())
+    return CORBA::string_dup("unknown");
+
+  SALOMEDS::GenericAttribute_var anAttribute;
+
+  std::string name("unknown");
+  if (aSObj->FindAttribute(anAttribute, "AttributeName")) {
+    SALOMEDS::AttributeName_var attrName = SALOMEDS::AttributeName::_narrow(anAttribute);
+    name = std::string(attrName->Value());
+  }
+
+  bool isInWorkspace = false;
+  //bool isPresentation = false;
+  int sourceId = -1;
+  int meshId = -1;
+  //int fieldSeriesId = -1;
+  int fieldId = -1;
+  int presentationId = -1;
+  if (aSObj->FindAttribute(anAttribute, "AttributeParameter")) {
+    SALOMEDS::AttributeParameter_var attrParam = SALOMEDS::AttributeParameter::_narrow(anAttribute);
+    if (attrParam->IsSet(IS_IN_WORKSPACE, PT_BOOLEAN))
+      isInWorkspace = attrParam->GetBool(IS_IN_WORKSPACE);
+    //if (attrParam->IsSet(IS_PRESENTATION, PT_BOOLEAN))
+    //  isPresentation = attrParam->GetBool(IS_PRESENTATION);
+    if (attrParam->IsSet(SOURCE_ID, PT_INTEGER))
+      sourceId = attrParam->GetInt(SOURCE_ID);
+    if (attrParam->IsSet(MESH_ID, PT_INTEGER))
+      meshId = attrParam->GetInt(MESH_ID);
+    //if (attrParam->IsSet(FIELD_SERIES_ID, PT_INTEGER))
+    //  fieldSeriesId = attrParam->GetInt(FIELD_SERIES_ID);
+    if (attrParam->IsSet(FIELD_ID, PT_INTEGER))
+      fieldId = attrParam->GetInt(FIELD_ID);
+    if (attrParam->IsSet(PRESENTATION_ID, PT_INTEGER))
+      presentationId = attrParam->GetInt(PRESENTATION_ID);
+  }
+
+  if (!aSObj->_is_nil() )
+    aSObj->UnRegister();
+
+  std::ostringstream oss;
+  if (sourceId > -1)
+    oss << "Source id: " << sourceId << std::endl;
+  if (meshId > -1)
+    oss << "Mesh id: " << meshId << std::endl;
+  //if (fieldSeriesId > -1)
+  //  oss << "Field series id: " << fieldSeriesId << std::endl;
+  if (fieldId > -1)
+    oss << "Field id: " << fieldId << std::endl;
+  //oss << "Is presentation: " << isPresentation << std::endl;
+  if (presentationId > -1)
+    oss << "Presentation id: " << presentationId << std::endl;
+  oss << "Is in workspace: " << isInWorkspace << std::endl;
+
+  return CORBA::string_dup(oss.str().c_str());
+}
+
 extern "C"
 {
   /*!
index 449049b0befb30db74fbcc04615f814f6dd94924..373051b53e062f8ca5857b619b7143d461180aaf 100644 (file)
@@ -58,7 +58,8 @@ public:
   MED_ORB::status registerPresentation(SALOMEDS::Study_ptr study,
                                        CORBA::Long fieldId,
                                        const char* name,
-                                       const char* label);
+                                       const char* label,
+                                       CORBA::Long presentationId);
 
   /*! Dump the study as a Python file */
   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
@@ -66,6 +67,10 @@ public:
                                        CORBA::Boolean isMultiFile,
                                        CORBA::Boolean& isValidScript);
 
+  // For tooltips
+  virtual CORBA::Boolean hasObjectInfo();
+  virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
+
  private:
   std::map<long, std::string> _fieldSeriesEntries;
 };
index a3f7cd0be7db6396f53d0767f64f43931b716ad0..c6cfe636e48e6dfe640c50d693c3d7332df61373 100644 (file)
@@ -215,7 +215,8 @@ void DatasourceController::OnExpandField()
     SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i);
 
     // First retrieve the fieldseries id associated to this study object
-    long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,OBJECT_ID);
+    //long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,FIELD_SERIES_ID);
+    long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,FIELD_ID);
     STDLOG("Expand the field timeseries "<<fieldseriesId);
 
     // If fieldseriesId equals -1, then it means that it is not a
@@ -236,8 +237,8 @@ void DatasourceController::OnExpandField()
       SALOMEDS::SObject_var soField = _studyEditor->newObject(soFieldseries);
       std::string label("it="); label += ToString(fieldHandler.iteration);
       _studyEditor->setName(soField,label.c_str());
-      _studyEditor->setParameterInt(soField, OBJECT_ID, fieldHandler.id);
-      _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,false);
+      _studyEditor->setParameterInt(soField, FIELD_ID, fieldHandler.id);
+      _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,false);
     }
   }
   _salomeModule->updateObjBrowser(true);
@@ -262,7 +263,7 @@ void DatasourceController::OnUseInWorkspace() {
 
     SALOMEDS::SObject_var soField = listOfSObject->at(0);
 
-    bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
+    bool isInWorkspace = _studyEditor->getParameterBool(soField,IS_IN_WORKSPACE);
     if ( isInWorkspace ) {
       QMessageBox::warning(_salomeModule->getApp()->desktop(),
          tr("Operation not allowed"),
@@ -270,7 +271,7 @@ void DatasourceController::OnUseInWorkspace() {
       return;
     }
 
-    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
 
     // If fieldId equals -1, then it means that it is not a field
     // managed by the MED module, and we stop this function process.
@@ -309,7 +310,7 @@ void DatasourceController::OnUseInWorkspace() {
     event->objectalias = alias;
     emit datasourceSignal(event);
     // Tag the item to prevent double import
-    //    _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+    //    _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true);
     // Tag the field as persistent on the server. It means that a
     // saving of the workspace will save at least this field (maybe it
     // should be an option?)
@@ -321,9 +322,9 @@ void DatasourceController::OnUseInWorkspace() {
     for (int i=0; i<listOfSObject->size(); i++) {
       SALOMEDS::SObject_var soField = listOfSObject->at(i);
 
-      bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
+      bool isInWorkspace = _studyEditor->getParameterBool(soField,IS_IN_WORKSPACE);
       if ( !isInWorkspace ) {
-        int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+        int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
         MEDCALC::FieldHandler* fieldHandler =
           MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
         DatasourceEvent* event = new DatasourceEvent();
@@ -335,7 +336,7 @@ void DatasourceController::OnUseInWorkspace() {
         // Note that this signal is processed by the WorkspaceController
 
         // Tag the item to prevent double import
-        //        _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+        //        _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true);
         // Tag the field as persistent on the server. It means that a
         // saving of the workspace will save at least this field (maybe it
         // should be an option?)
index ceaf424bb527c281bd1337b1967ad7898b1184d8..edeeb576c79516491c913e5fe65df3ba202ff50b 100644 (file)
@@ -164,7 +164,7 @@ PresentationController::visualize(PresentationEvent::EventType eventType)
   // to make a view of an object from the tui console).
   for (int i=0; i<listOfSObject->size(); i++) {
     SALOMEDS::SObject_var soField = listOfSObject->at(i);
-    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
     // If fieldId equals -1, then it means that it is not a field
     // managed by the MED module, and we stop this function process.
     if ( fieldId < 0 )
@@ -240,7 +240,7 @@ PresentationController::updateTreeViewWithNewPresentation(long fieldId, long pre
   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(_salomeModule->application()->activeStudy());
   _PTR(Study) studyDS = study->studyDS();
 
-  _salomeModule->engine()->registerPresentation(_CAST(Study, studyDS)->GetStudy(), fieldId, name.c_str(), label.c_str());
+  _salomeModule->engine()->registerPresentation(_CAST(Study, studyDS)->GetStudy(), fieldId, name.c_str(), label.c_str(), presentationId);
 
   // update Object browser
   _salomeModule->getApp()->updateObjectBrowser(true);
index a7ce3c5e60a8839f44eeb59b0087de4597cfabef..a554668d76d6d2cd0029eb91ab49ef3028e228fa 100644 (file)
@@ -86,7 +86,8 @@ ProcessingController::OnChangeUnderlyingMesh()
   SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
   if ( listOfSObject->size() > 0 ) {
     SALOMEDS::SObject_var soField = listOfSObject->at(0);
-    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    //int fieldId = _studyEditor->getParameterInt(soField,FIELD_SERIES_ID);
+    int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
     // _GBO_ : the dialog should not be modal, so that we can choose a
     // mesh in the browser. Then we have to emit a signal from the
     // dialog.accept, connected to a slot of the DatasourceControler
@@ -141,7 +142,7 @@ ProcessingController::OnInterpolateField()
   SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
   if ( listOfSObject->size() > 0 ) {
     SALOMEDS::SObject_var soField = listOfSObject->at(0);
-    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
     // _GBO_ : the dialog should not be modal, so that we can choose a
     // mesh in the browser. Then we have to emit a signal from the
     // dialog.accept, connected to a slot of the DatasourceControler
index cfb1b506e6610479cca1f89a5c1cb5d6b9e809f4..b38d17ed1ed0bb350c22c1b39b9c4b1867f7e138 100644 (file)
@@ -504,12 +504,14 @@ void WorkspaceController::processDatasourceEvent(const DatasourceEvent* event) {
   }
   else if ( event->eventtype == DatasourceEvent::EVENT_ADD_DATASOURCE ) {
     QStringList commands;
-    commands += QString("medcalc.LoadDataSource('%1')").arg(event->objectalias);
+    commands += QString("source_id = medcalc.LoadDataSource('%1')").arg(event->objectalias);
+    commands += QString("source_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE ) {
     QStringList commands;
-    commands += QString("medcalc.LoadImageAsDataSource('%1')").arg(event->objectalias);
+    commands += QString("source_id = medcalc.LoadImageAsDataSource('%1')").arg(event->objectalias);
+    commands += QString("source_id");
     _consoleDriver->exec(commands);
   }
   else {
@@ -570,42 +572,48 @@ void WorkspaceController::processPresentationEvent(const PresentationEvent* even
     QString colorMap = _getColorMap();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakeScalarMap(accessField(%1), %2, colorMap=%3)").arg(fieldHandler->id).arg(viewMode).arg(colorMap);
+    commands += QString("presentation_id = medcalc.MakeScalarMap(accessField(%1), %2, colorMap=%3)").arg(fieldHandler->id).arg(viewMode).arg(colorMap);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_CONTOUR ) {
     QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakeContour(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id = medcalc.MakeContour(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_VECTOR_FIELD ) {
     QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id = medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
     QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id = medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
     QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id = medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_POINT_SPRITE ) {
     QString viewMode = _getViewMode();
     MEDCALC::FieldHandler* fieldHandler = dataObject->getFieldHandler();
     QStringList commands;
-    commands += QString("medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id = medcalc.MakePointSprite(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
+    commands += QString("presentation_id");
     _consoleDriver->exec(commands);
   }
   else {
index c51ca9bdaf466c2bca489456683705046014454f..26defc750ed7fa9f7bf981ccb46c612075832988 100644 (file)
@@ -66,7 +66,7 @@ void DlgChangeUnderlyingMesh::OnSelectMesh() {
     SALOMEDS::SObject_var soMesh = listOfSObject->at(0);
     // _GBO_ TODO: we should test here if it is a mesh (attribute in
     // the sobject)
-    _meshId = _studyEditor->getParameterInt(soMesh,OBJECT_ID);
+    _meshId = _studyEditor->getParameterInt(soMesh,MESH_ID);
     const char * meshname = _studyEditor->getName(soMesh);
     this->ui.txtMesh->setText(QString(meshname));
   }
index 8daf9886bfc68dcf117dc0e2400e50085d5519b3..4ef53c6f2ec3b36cfbb94bec799a0d93e348eaee 100644 (file)
@@ -115,7 +115,7 @@ void DlgInterpolateField::OnSelectMesh() {
     SALOMEDS::SObject_var soMesh = listOfSObject->at(0);
     // _GBO_ TODO: we should test here if it is a mesh (attribute in
     // the sobject)
-    _meshId = _studyEditor->getParameterInt(soMesh,OBJECT_ID);
+    _meshId = _studyEditor->getParameterInt(soMesh,MESH_ID);
     const char * meshname = _studyEditor->getName(soMesh);
     this->ui.txtMesh->setText(QString(meshname));
   }
index ac563982b7a4b35e7e6c5d1f861b0838e79087c9..97def727cf8eeb15a9ac498e51c1d882959e1e14 100644 (file)
@@ -109,8 +109,8 @@ def notifyGui_removeFromWorkspace(fieldId):
 def notifyGui_cleanWorkspace():
   __notifyGui(MEDCALC.EVENT_CLEAN_WORKSPACE)
 #
-def notifyGui_addDatasource(filename):
-  __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, filename=filename)
+def notifyGui_addDatasource(handlerId, filename):
+  __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, dataId=handlerId, filename=filename)
 #
 def notifyGui_addPresentation(fieldId, presId):
   __notifyGui(MEDCALC.EVENT_ADD_PRESENTATION, dataId=fieldId, presentationId=presId)
index b0c42e23ec8bfc29cec25eb43b28a03131723140..364fbba3fa5fba607fa9692ba52c0cc8e18e3df3 100644 (file)
@@ -21,9 +21,10 @@ import medcalc
 
 def LoadDataSource(filename):
   dataManager = medcalc.medcorba.factory.getDataManager()
-  dataManager.loadDatasource(filename)
+  handler = dataManager.loadDatasource(filename)
   from medcalc.medevents import notifyGui_addDatasource
-  notifyGui_addDatasource(filename)
+  notifyGui_addDatasource(handler.id, filename)
+  return handler.id
 #
 
 def LoadImageAsDataSource(filename):
@@ -36,5 +37,5 @@ def LoadImageAsDataSource(filename):
   from medimages import FieldBuilder
   builder = FieldBuilder()
   builder.image2med(filename, medfilename)
-  LoadDataSource(medfilename)
+  return LoadDataSource(medfilename)
 #
index fd1100627f61c7e55ea099ec3023c95110d7480d..eeac1b0636163540bceda1e9670ff1b11a9869b1 100644 (file)
@@ -35,6 +35,7 @@ def MakeScalarMap(proxy,
   params = MEDCALC.ScalarMapParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
   presentation_id = __manager.makeScalarMap(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #
 
 def MakeContour(proxy,
@@ -48,6 +49,7 @@ def MakeContour(proxy,
   params = MEDCALC.ContourParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap, nbContours)
   presentation_id = __manager.makeContour(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #
 
 def MakeVectorField(proxy,
@@ -56,6 +58,7 @@ def MakeVectorField(proxy,
   params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
   presentation_id = __manager.makeVectorField(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #
 
 def MakeSlices(proxy,
@@ -66,6 +69,7 @@ def MakeSlices(proxy,
   params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
   presentation_id = __manager.makeSlices(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #
 
 def MakeDeflectionShape(proxy,
@@ -74,6 +78,7 @@ def MakeDeflectionShape(proxy,
   params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
   presentation_id = __manager.makeDeflectionShape(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #
 
 def MakePointSprite(proxy,
@@ -86,4 +91,5 @@ def MakePointSprite(proxy,
   params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
   presentation_id = __manager.makePointSprite(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
+  return presentation_id
 #