]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix on - Bug 8779
authorapo <apo@opencascade.com>
Fri, 13 May 2005 13:30:57 +0000 (13:30 +0000)
committerapo <apo@opencascade.com>
Fri, 13 May 2005 13:30:57 +0000 (13:30 +0000)
  View Parameters not restored after Dump study

src/VISU_I/VISU_DumpPython.cc
src/VISU_SWIG/visu.py

index 491de818c6016ebaa313eeee3e71c332fd08b0ec..2b2bf1ac8a6a48c6fab1f978a0940d274ea84aaa 100644 (file)
@@ -263,7 +263,6 @@ namespace VISU{
     }
 
     std::string aSObjectName = GetName(theSObject);
-    theStr<<thePrefix<<"aSComponent = theStudy.FindComponent('VISU')"<<endl;
     theStr<<thePrefix<<aSObjectName<<" = aBuilder.NewObject(aSComponent)"<<endl;
     theStr<<thePrefix<<"if "<<aSObjectName<<":"<<endl;
     thePrefix += PREFIX;
@@ -988,7 +987,6 @@ namespace VISU{
            }
          }else if(strcmp(aTypeName.latin1(),"VIEW3D") == 0){
            std::string aName = GetName(theSObject);
-           theStr<<thePrefix<<"aSComponent = theStudy.FindComponent('VISU')"<<endl;
            theStr<<thePrefix<<aName<<" = aBuilder.NewObject(aSComponent)"<<endl;
 
            theStr<<thePrefix<<"if "<<aName<<":"<<endl;
@@ -1138,6 +1136,7 @@ namespace VISU{
     aStr<<aPrefix<<"import visu"<<endl;
     aStr<<endl;
     aStr<<aPrefix<<"aVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,theStudy,0)"<<endl;
+    aStr<<aPrefix<<"aSComponent = visu.PublishComponent(theStudy)"<<endl;
     aStr<<aPrefix<<"aMed = lcc.FindOrLoadComponent('FactoryServer','MED')"<<endl;
     aStr<<aPrefix<<"aBuilder = theStudy.NewBuilder()"<<endl;
     aStr<<aPrefix<<"aName2ObjectMap = {}"<<endl;
index fc023764d0d9fe39a7f352a2741064364050a569..85c1131c0f97b6a4a8b3b7a3b7c8d6afe7af008d 100644 (file)
@@ -48,7 +48,40 @@ def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, the
     myLocalStudy = theStudy
     myLocalVisu.SetCurrentStudy(myLocalStudy)
     return myLocalVisu
+
+def PublishComponent(theStudyDocument):
+    aComponentDataType = myLocalVisu.ComponentDataType()
+    aSComponent = theStudyDocument.FindComponent(aComponentDataType)
+    if aSComponent == None:
+        aStudyBuilder = theStudyDocument.NewBuilder()
+        aStudyBuilder.NewCommand()
+        aLocked = theStudyDocument.GetProperties().IsLocked()
+        if aLocked:
+            theStudyDocument.GetProperties().SetLocked(0)
+            pass
+
+        aSComponent = aStudyBuilder.NewComponent(aComponentDataType);
+        aName = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributeName")
+        aModuleCatalog = myNamingService.Resolve("/Kernel/ModulCatalog");
+        aComponent = aModuleCatalog.GetComponent(aComponentDataType);
+        if aComponent != None:
+            aComponentUserName = aComponent._get_componentusername()
+            aName.SetValue(aComponentUserName)
+            pass
+        
+        aPixMap = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributePixMap")
+        aPixMap.SetPixMap("ICON_OBJBROWSER_Visu")
+        
+        aStudyBuilder.DefineComponentInstance(aSComponent,myLocalVisu);
+        if aLocked:
+            theStudyDocument.GetProperties().SetLocked(1);
+            pass
+        
+        aStudyBuilder.CommitCommand();
+        pass
     
+    return aSComponent;
+        
 def StrToMap(theString) :
     aPairList = split(theString,";")
     aMap = {}