]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: update dump study in salome_study.py
authorcaremoli <caremoli>
Wed, 16 Jan 2008 08:08:22 +0000 (08:08 +0000)
committercaremoli <caremoli>
Wed, 16 Jan 2008 08:08:22 +0000 (08:08 +0000)
src/KERNEL_PY/salome_study.py

index 22b460dd651ec9f008d7f5f9e3c4ea71c31f888d..3c86ed63ae0061e2ac498d8c18ed415e8825d489 100644 (file)
@@ -31,49 +31,50 @@ from launchConfigureParser import verbose
 
 #--------------------------------------------------------------------------
 
-def DumpComponent(Study, SO, offset):
-    it = Study.NewChildIterator(SO)
-    Builder = Study.NewBuilder()
-    while it.More():
-        CSO = it.Value()
-        it.Next()
-        anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
-        AtName = anAttr._narrow(SALOMEDS.AttributeName)
-        t_name = AtName.Value()
-        if t_name[0] == 1:
-            ofs = 1
-            a = ""
-            while ofs <= offset:
-                a = a + "--"
-                ofs = ofs +1
-            MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) )
-        t_RefSO = CSO.ReferencedObject()
-        if t_RefSO[0] == 1:
-            RefSO = t_RefSO[1]
-            ofs = 1
-            a = ""
-            while ofs <= offset:
-                a = a + "  "
-                ofs = ofs +1
-            MESSAGE( a + ">" + str(RefSO.GetID()) )
-        DumpComponent(Study, CSO, offset+2)
+def DumpComponent(Study, SO, Builder,offset):
+  it = Study.NewChildIterator(SO)
+  while it.More():
+    CSO = it.Value()
+    a=offset*"--" + ">" + CSO.GetID()
+    find,AtName = Builder.FindAttribute(CSO, "AttributeName")
+    if find:
+      a=a+":"+AtName.Value()
+    find,AtIOR = Builder.FindAttribute(CSO, "AttributeIOR")
+    if find:
+      a=a+":"+AtIOR.Value()
+    find,RefSO = CSO.ReferencedObject()
+    if find:
+      a=a+":"+RefSO.GetID()
+    print a
+    DumpComponent(Study, CSO, Builder,offset+2)
+    it.Next()
 
-    #--------------------------------------------------------------------------
+#--------------------------------------------------------------------------
 
 def DumpStudy(Study):
     """
     Dump a study, given the ior
     """
     itcomp = Study.NewComponentIterator()
+    Builder = Study.NewBuilder()
     while itcomp.More():
-        SC = itcomp.Value()
-        itcomp.Next()
-        name = SC.ComponentDataType()
-        MESSAGE( "-> ComponentDataType is " + name )
-        DumpComponent(Study, SC, 1)
-        
+      SC = itcomp.Value()
+      name = SC.ComponentDataType()
+      print "-> ComponentDataType is " + name
+      DumpComponent(Study, SC,Builder, 1)
+      itcomp.Next()
+
+def DumpStudies():
+  """
+    Dump all studies in a StudyManager
+  """
+  for name in myStudyManager.GetOpenStudies():
+    s=myStudyManager.GetStudyByName(name)
+    print "study:",name, s._get_StudyId()
+    DumpStudy(s)
 
-    #--------------------------------------------------------------------------
+
+#--------------------------------------------------------------------------
 
 def IDToObject(id):
     myObj = None