1 #==============================================================================
3 # Created : sam nov 10 00:49:00 CET 2001
4 # Author : Paul RASCLE, EDF
8 #==============================================================================
10 from omniORB import CORBA
11 from LifeCycleCORBA import *
12 from libSALOME_Swig import *
14 from SALOME_NamingServicePy import *
16 from SALOME_utilities import *
18 #--------------------------------------------------------------------------
20 def DumpComponent(Study, SO, offset):
21 it = Study.NewChildIterator(SO)
22 Builder = Study.NewBuilder()
26 anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
27 AtName = anAttr._narrow(SALOMEDS.AttributeName)
28 t_name = AtName.Value()
35 MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) )
36 t_RefSO = CSO.ReferencedObject()
44 MESSAGE( a + ">" + str(RefSO.GetID()) )
45 DumpComponent(Study, CSO, offset+2)
47 #--------------------------------------------------------------------------
50 itcomp = Study.NewComponentIterator()
54 name = SC.ComponentDataType()
55 MESSAGE( "-> ComponentDataType is " + name )
56 DumpComponent(Study, SC, 1)
59 #--------------------------------------------------------------------------
61 def ImportComponentGUI(ComponentName):
62 libName = "lib" + ComponentName + "_Swig"
63 command = "from " + libName + " import *"
65 constructor = ComponentName + "GUI_Swig()"
66 command = "gui = " + constructor
70 #--------------------------------------------------------------------------
72 def SalomeGUIgetAllSelected(self):
73 selNumber = self.SelectedCount()
75 for i in range(selNumber):
76 listSelected.append(self.getSelected(i))
79 class SalomeGUI(SALOMEGUI_Swig):
80 getAllSelected = SalomeGUIgetAllSelected
82 #--------------------------------------------------------------------------
85 mySO = myStudy.FindObjectID(id);
86 Builder = myStudy.NewBuilder()
87 anAttr = Builder.FindOrCreateAttribute(mySO, "AttributeIOR")
88 AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
89 myObj = orb.string_to_object(AtIOR.Value())
93 mySO = myStudy.FindObjectID(id);
96 #--------------------------------------------------------------------------
99 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
101 # create an LifeCycleCORBA instance
102 lcc = LifeCycleCORBA(orb)
104 # create an SALOMEGUI_Swig instance
107 #create an naming service instance
108 naming_service = SALOME_NamingServicePy_i(orb)
110 # get active study name and id
111 myStudyName = sg.getActiveStudyName()
112 MESSAGE( myStudyName )
114 myStudyId = sg.getActiveStudyId()
115 MESSAGE( str(myStudyId) )
117 # get Study Manager reference
118 obj = naming_service.Resolve('myStudyManager')
119 myStudyManager = obj._narrow(SALOMEDS.StudyManager)
122 myStudy = myStudyManager.GetStudyByName(myStudyName)