From: Cédric Aguerre Date: Wed, 13 Apr 2016 15:13:39 +0000 (+0200) Subject: [MEDCalc] Show object info (ids) in OB X-Git-Tag: V8_1_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=18c20cf8bb706b7efeceb94d9f2e4dde84513d32;p=modules%2Fmed.git [MEDCalc] Show object info (ids) in OB --- diff --git a/idl/MED_Gen.idl b/idl/MED_Gen.idl index 84589339c..5df35be24 100644 --- a/idl/MED_Gen.idl +++ b/idl/MED_Gen.idl @@ -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); }; }; diff --git a/src/MEDCalc/MEDCalcConstants.hxx b/src/MEDCalc/MEDCalcConstants.hxx index 995cb149b..e9c72abbf 100644 --- a/src/MEDCalc/MEDCalcConstants.hxx +++ b/src/MEDCalc/MEDCalcConstants.hxx @@ -19,14 +19,15 @@ // 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" diff --git a/src/MEDCalc/cmp/MED.cxx b/src/MEDCalc/cmp/MED.cxx index 6eae6c580..c89b152ad 100644 --- a/src/MEDCalc/cmp/MED.cxx +++ b/src/MEDCalc/cmp/MED.cxx @@ -26,8 +26,10 @@ #include #include +#include #include +#include /*! \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" { /*! diff --git a/src/MEDCalc/cmp/MED.hxx b/src/MEDCalc/cmp/MED.hxx index 449049b0b..373051b53 100644 --- a/src/MEDCalc/cmp/MED.hxx +++ b/src/MEDCalc/cmp/MED.hxx @@ -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 _fieldSeriesEntries; }; diff --git a/src/MEDCalc/gui/DatasourceController.cxx b/src/MEDCalc/gui/DatasourceController.cxx index a3f7cd0be..c6cfe636e 100644 --- a/src/MEDCalc/gui/DatasourceController.cxx +++ b/src/MEDCalc/gui/DatasourceController.cxx @@ -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 "<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; isize(); 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?) diff --git a/src/MEDCalc/gui/PresentationController.cxx b/src/MEDCalc/gui/PresentationController.cxx index ceaf424bb..edeeb576c 100644 --- a/src/MEDCalc/gui/PresentationController.cxx +++ b/src/MEDCalc/gui/PresentationController.cxx @@ -164,7 +164,7 @@ PresentationController::visualize(PresentationEvent::EventType eventType) // to make a view of an object from the tui console). for (int i=0; isize(); 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(_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); diff --git a/src/MEDCalc/gui/ProcessingController.cxx b/src/MEDCalc/gui/ProcessingController.cxx index a7ce3c5e6..a554668d7 100644 --- a/src/MEDCalc/gui/ProcessingController.cxx +++ b/src/MEDCalc/gui/ProcessingController.cxx @@ -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 diff --git a/src/MEDCalc/gui/WorkspaceController.cxx b/src/MEDCalc/gui/WorkspaceController.cxx index cfb1b506e..b38d17ed1 100644 --- a/src/MEDCalc/gui/WorkspaceController.cxx +++ b/src/MEDCalc/gui/WorkspaceController.cxx @@ -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 { diff --git a/src/MEDCalc/gui/dialogs/DlgChangeUnderlyingMesh.cxx b/src/MEDCalc/gui/dialogs/DlgChangeUnderlyingMesh.cxx index c51ca9bda..26defc750 100644 --- a/src/MEDCalc/gui/dialogs/DlgChangeUnderlyingMesh.cxx +++ b/src/MEDCalc/gui/dialogs/DlgChangeUnderlyingMesh.cxx @@ -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)); } diff --git a/src/MEDCalc/gui/dialogs/DlgInterpolateField.cxx b/src/MEDCalc/gui/dialogs/DlgInterpolateField.cxx index 8daf9886b..4ef53c6f2 100644 --- a/src/MEDCalc/gui/dialogs/DlgInterpolateField.cxx +++ b/src/MEDCalc/gui/dialogs/DlgInterpolateField.cxx @@ -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)); } diff --git a/src/MEDCalc/tui/medevents.py b/src/MEDCalc/tui/medevents.py index ac563982b..97def727c 100644 --- a/src/MEDCalc/tui/medevents.py +++ b/src/MEDCalc/tui/medevents.py @@ -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) diff --git a/src/MEDCalc/tui/medio.py b/src/MEDCalc/tui/medio.py index b0c42e23e..364fbba3f 100644 --- a/src/MEDCalc/tui/medio.py +++ b/src/MEDCalc/tui/medio.py @@ -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) # diff --git a/src/MEDCalc/tui/medpresentation.py b/src/MEDCalc/tui/medpresentation.py index fd1100627..eeac1b063 100644 --- a/src/MEDCalc/tui/medpresentation.py +++ b/src/MEDCalc/tui/medpresentation.py @@ -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 #