From: mpa Date: Fri, 3 Feb 2017 13:19:13 +0000 (+0300) Subject: Deleted Study parameter X-Git-Tag: V9_0_0~2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=32ba9e042c80889dbab32724a135d8895e392da9;p=modules%2Fhexablock.git Deleted Study parameter --- diff --git a/doc/tui_component.rst b/doc/tui_component.rst index d35241d..1a74d04 100644 --- a/doc/tui_component.rst +++ b/doc/tui_component.rst @@ -31,10 +31,6 @@ Get the document number *i*:: Remove a document in the session:: hexablock.removeDocument(doc_i) - -Set the current study:: - - hexablock.SetCurrentStudy(theStudy) Get a document from the current study:: diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 89a4f09..5ea5168 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -337,15 +337,6 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy ) this, SLOT( onWindowClosed(SUIT_ViewWindow *) ), Qt::UniqueConnection ); } - /* ************************************ TODO Hexa6 - _hexaEngine->SetCurrentStudy(SALOMEDS::Study::_nil()); - if ( SalomeApp_Study* s = dynamic_cast( theStudy )) - if ( _PTR(Study) aStudy = s->studyDS()) { - _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() ); - updateObjBrowser(); // objects can be removed - } - ************************************ */ - if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) currentOccGView->getViewWindow()->installEventFilter(this); @@ -418,7 +409,7 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy ) return bOk; } -SALOMEDS::Study_var HEXABLOCKGUI::ClientStudy() +SALOMEDS::Study_var HEXABLOCKGUI::getStudyServant() { SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); CORBA::Object_var aSMObject = aNamingService->Resolve("/Study"); @@ -435,7 +426,7 @@ void HEXABLOCKGUI::addInStudy(QMap& topo_shapes, SalomeApp_Study* appStudy = HEXABLOCKGUI::activeStudy(); if(!appStudy) return; - SALOMEDS::Study_var aDSStudy = ClientStudy(); + SALOMEDS::Study_var aDSStudy = getStudyServant(); SALOMEDS::StudyBuilder_var aBuilder (aDSStudy->NewBuilder()); QString entry = currentDocGView->getDocumentModel()->documentEntry(); SALOMEDS::SObject_var aFatherSO = aDSStudy->FindObjectID( qPrintable(entry) ); @@ -499,29 +490,18 @@ bool HEXABLOCKGUI::renameObject( const QString& entry, const QString& name) if (dgview == NULL || dgview->getDocumentModel() == NULL) return result; - SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication()); - SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; - - if(!appStudy) - return result; - - _PTR(Study) aStudy = appStudy->studyDS(); - - if(!aStudy) - return result;; - - _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) ); + _PTR(SObject) obj ( SalomeApp_Application::getStudy()->FindObjectID(qPrintable(entry)) ); _PTR(GenericAttribute) anAttr; if ( obj ){ - if ( obj->FindAttribute(anAttr, "AttributeName") ){ - _PTR(AttributeName) aName (anAttr); - DocumentModel* docModel = dgview->getDocumentModel(); - docModel->setName( name ); - aName->SetValue( name.toLatin1().data() ); - getApp()->updateObjectBrowser(); -// _dwPattern->setWindowTitle( name ); - result = true; - } + if ( obj->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) aName (anAttr); + DocumentModel* docModel = dgview->getDocumentModel(); + docModel->setName( name ); + aName->SetValue( name.toLatin1().data() ); + getApp()->updateObjectBrowser(); +// _dwPattern->setWindowTitle( name ); + result = true; + } } return result; } @@ -824,7 +804,7 @@ bool HEXABLOCKGUI::createSComponent() //addComponent DEBTRACE("HEXABLOCKGUI::createSComponent"); // --- Find or create (if not done yet) "HEXABLOCK" SComponent in the study - _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS(); + _PTR(Study) aStudy = SalomeApp_Application::getStudy(); _PTR(StudyBuilder) aBuilder (aStudy->NewBuilder()); _PTR(GenericAttribute) anAttr; _PTR(AttributeName) aName; @@ -3213,7 +3193,7 @@ QString HEXABLOCKGUI::addDocInStudy (HEXA_NS::Document* document) if (app_study == NULL) return docEntry; - SALOMEDS::Study_var ds_study = ClientStudy(); + SALOMEDS::Study_var ds_study = getStudyServant(); SALOMEDS::StudyBuilder_var aBuilder (ds_study->NewBuilder()); QString entry = app_study->centry("HEXABLOCK"); SALOMEDS::SObject_var aFatherSO = ds_study->FindObjectID( qPrintable(entry) ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx index c7efb37..2b37fa2 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -136,7 +136,7 @@ public: // static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* ); static LightApp_SelectionMgr* selectionMgr(); - static SALOMEDS::Study_var ClientStudy(); + static SALOMEDS::Study_var getStudyServant(); static ViewType getActiveViewType(); static HEXABLOCKGUI* getInstance(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx index 27a62c4..50737ef 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx @@ -32,7 +32,6 @@ #include -#include #include #include @@ -89,13 +88,12 @@ namespace GUI } - _PTR(Study) GetActiveStudyDocument() + _PTR(Study) getStudy() { - SalomeApp_Study* aStudy = dynamic_cast(GetActiveStudy()); - if (aStudy) - return aStudy->studyDS(); - else - return _PTR(Study)(); + static _PTR(Study) _study; + if(!_study) + _study = SalomeApp_Application::getStudy(); + return _study; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx index 2683d48..9515fa0 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx @@ -41,7 +41,7 @@ namespace HEXABLOCK { HEXABLOCK_EXPORT SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry ); - _PTR(Study) GetActiveStudyDocument(); + _PTR(Study) getStudy(); HEXABLOCK_EXPORT int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/ const Handle(SALOME_InteractiveObject)& theIO, diff --git a/src/HEXABLOCK_SWIG/hexablock.py b/src/HEXABLOCK_SWIG/hexablock.py index 6698c87..cd94a9e 100644 --- a/src/HEXABLOCK_SWIG/hexablock.py +++ b/src/HEXABLOCK_SWIG/hexablock.py @@ -28,12 +28,12 @@ import salome salome.salome_init() from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() component = hexablock_swig.hex_instance () @@ -149,7 +149,7 @@ def mesh (doc, name=None, dim=3, container="FactoryServer"): geompy.addToStudy(shape, name) comp_smesh = salome.lcc.FindOrLoadComponent(container, "SMESH") - comp_smesh.init_smesh(study, geomBuilder.geom) + comp_smesh.init_smesh(geomBuilder.geom) meshexa = comp_smesh.Mesh(shape) so = "libHexaBlockPluginEngine.so" @@ -188,8 +188,8 @@ def getFromStudy(entry): # ==================================================== findOrCreateComponent # Find or create HexaBlock Study Component -def findOrCreateComponent( study, builder ): - father = study.FindComponent( moduleName() ) +def findOrCreateComponent( builder ): + father = salome.myStudy.FindComponent( moduleName() ) if father is None: father = builder.NewComponent( moduleName() ) attr = builder.FindOrCreateAttribute( father, "AttributeName" ) @@ -208,7 +208,7 @@ def addToStudy(doc): study = salome.myStudy builder = study.NewBuilder() - father = findOrCreateComponent( study, builder ) + father = findOrCreateComponent( builder ) name = doc.getName () present = study.FindObjectByName(name, moduleName())