2 \page KERNEL_Services KERNEL Services for end user (Python interface)
4 In a %SALOME application, distributed components, servers and clients use
5 the CORBA middleware for comunication. CORBA interfaces are defined via idl
6 files. All the different CORBA interfaces are available for users in Python,
7 see CORBA interfaces below.
9 For some general purpose services, CORBA interfaces have been encapsulated
10 in order to provide a simple interface (encapsulation is generally done in
11 C++ classes, and a Python SWIG interface is also generated from C++, to
12 ensure a consistent behavior between C++ modules and Python modules or user
15 \section S1_kernel_ser General purpose services
17 \subsection subsection11 SALOME services access from a Python shell
19 See \ref SALOME_Application for detailed instructions on how to launch a Python
20 interpreter with full access to the %SALOME environment and services.
22 You can use the embedded Python interpreter in Graphical User Interface, or an
23 external interpreter, with:
30 In either cases, %SALOME services access is done with:
37 In the embedded interpreter, it is already done, but there is no problem to
38 do it several times, so it is preferable to add these instructions
39 systematically in your scripts, to allow them to work in all configurations.
40 See \ref kernel_salome for a short description of most useful variables and
43 \subsection subsection12 Container and component instantiation
45 See SALOME_LifeCycleCORBA for the C++ interface (Python interface obtained with SWIG
48 In the following example, a test component provided in KERNEL is launched
49 in the local container, "FactoryServer", created when %SALOME starts:
56 lcc = LifeCycleCORBA.LifeCycleCORBA()
57 obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
60 comp=obj._narrow(Engines.TestComponent)
65 The answer is something like:
68 'TestComponent_i : L = 1'
71 The _narrow() instruction is not always mandatory in Python, but sometimes
72 useful to be sure you have got the right type of %object. Here, Testcomponent
73 interface is defined in CORBA module Engines. With this example, it works also
74 without the _narrow() instruction:
80 In the next example, a component instance is created in a specific Container
81 defined by it's computer hostname and it's name. Here we use the local
82 computer. Note that in Utils_Identity, Utils_Identity::getShortHostName() gives the short
83 hostname of the computer, without domain suffixes, which is used in %SALOME.
84 The container process is created here if it does not exists, and a new
85 component instance is created:
91 lcc = LifeCycleCORBA.LifeCycleCORBA()
94 host = Utils_Identity.getShortHostName()
98 params['hostname']=host
99 params['container_name']='myContainer'
100 comp=lcc.LoadComponent(params,'SalomeTestComponent')
104 If you want to get a list of containers and component instances, client %object
105 from orbmodule provides a list:
109 clt=orbmodule.client()
117 ContainerManager.object
120 FactoryServerPy.object
121 SuperVisionContainer.object
124 SalomeTestComponent_inst_1.object
127 SalomeTestComponent_inst_1.object
128 SalomeTestComponent_inst_2.object
138 myStudyManager.object
139 SalomeAppEngine.object
142 \subsection subsection13 File transfer service
144 See SALOME_FileTransferCORBA for the C++ interface (Python interface obtained with
145 SWIG is very similar).
147 The following example shows how to transfer a file from a remote host to the
148 client computer. Remote hostname is 'cli76cc', we would like to copy
149 'tkcvs_8_0_3.tar.gz' from remote to local computer. %A full pathname is
150 required. %A container is created on remote computer if it does not exist,
151 to handle the file transfer:
157 import LifeCycleCORBA
158 remotefile="/home/prascle/tkcvs_8_0_3.tar.gz"
159 aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile)
160 localFile=aFileTransfer.getLocalFile()
163 \subsection subsection14 CORBA Naming service access
165 See SALOME_NamingService for the C++ interface. The Python interface
166 SALOME_NamingServicePy::SALOME_NamingServicePy_i is not yet derived from the C++ interface and offers
167 only the most useful functions.
169 \section S2_kernel_ser All IDL Interfaces
171 -# <b>Containers and component life cycle, File transfer service</b>
172 - Engines : engines CORBA module.
173 - Engines::EngineComponent : generic component interface. All %SALOME components inherit this interface.
174 - Engines::Container : host for C++ and Python components components instances
175 - Engines::fileTransfer : agent for file transfer created by a container copy a local file to a distent client
176 - Engines::fileRef : reference to a file, used by a container for file transfers
177 - Engines::ContainerManager : unique instance, in charge of container creation on remote computers
178 - Engines::MPIContainer : a parallel implementation for containers and components
181 -# <b>Study management</b>
182 - SALOMEDS : SALOMEDS CORBA module
183 - SALOMEDS.idl : \copybrief SALOMEDS.idl
184 - SALOMEDS_Attributes.idl : \copybrief SALOMEDS_Attributes.idl
186 -# <b>High speed transfer, object life cycle, exceptions, GUI interface...</b>
187 - SALOME : \copybrief SALOME
188 - SALOME_Comm.idl : \copybrief SALOME_Comm.idl
189 - SALOME_GenericObj.idl : \copybrief SALOME_GenericObj.idl
190 - SALOME_Exception.idl : \copybrief SALOME_Exception.idl
191 - SALOME_Session.idl : \copybrief SALOME_Session.idl
193 -# <b>Miscelleanous</b>
194 - SALOME_ModuleCatalog : \copybrief SALOME_ModuleCatalog
195 - SALOME_RessourcesCatalog : \copybrief SALOME_RessourcesCatalog
196 - Registry : \copybrief Registry
197 - SALOME_Logger : \copybrief SALOME_Logger
199 -# <b>Other idl for test purposes</b>
200 - NSTEST : for naming service test
201 - SALOME_TestComponent.idl : for EngineComponent test
202 - SALOME_TestModuleCatalog : for SALOME_ModuleCatalog test
203 - SALOME_TestMPIComponent.idl : \copybrief SALOME_TestMPIComponent.idl
204 - TestNotif.idl : \copybrief TestNotif.idl
206 -# <b>Some useful command scripts </b>
207 - waitNS.py : \copybrief waitNS.py
208 - waitContainers.py : \copybrief waitContainers.py
209 - showNS.py : \copybrief showNS.py
210 - shutdownSalome.py : \copybrief shutdownSalome.py
211 - killSalome.py : \copybrief killSalome.py
212 - killSalomeWithPort.py : \copybrief killSalomeWithPort.py
213 - appli_gen.py : \copybrief appli_gen.py
218 /** \example example1
219 AttributeReal interface (creations/saving/restoring)
221 Methods : FindOrCreateAttribute, Value, SaveAs, SetValue, FindComponent, FindAttribute, Open
223 /** \example example3
224 AttributeSequenceOfReal interface(creations/saving/restoring)\n
225 AttributeSequenceOfReal : ChangeValue, Add, Value, Remove, Length\n
226 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open
228 /** \example example16
229 Methods : GetAvailableUndos, ChangeValue, FindOrCreateAttribute, SaveAs, GetAvailableRedos, Undo, FindComponent, Redo, FindAttribute, Open, CommitCommand, NewCommand
231 /** \example example17
232 SALOMEDS methods : RemoveAttribute, FindOrCreateAttribute, NewStudy, GetAllAttributes, NewCommand, CommitCommand, AbortCommand, NewComponent
234 /** \example example18
235 AttributeTreeNode interface(creations/saving/restoring)\n
236 SALOMEDS methods : FindOrCreateAttribute, NewObject\n
237 Attribute methods : HasFirst, HasFather, SetPrevious, Next, InsertAfter, GetFather, HasNext, SetValue, Append, NewStudy, Label, IsRoot, Prepend, SetFather, Depth, HasPrevious
239 /** \example example19
240 SALOMEDS methods : FindOrCreateAttribute, Save, SaveAs, Close, Open, FindComponent, FindAttribute, FindObject, LoadWith
242 Attribute methods : Value, SetValue
244 /** \example example20
245 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, NewCommand, GetProperties, Open, CommitCommand, NewBuilder\n
246 Attribute methods : SetLocked, IsLocked, GetCreationMode, SetCreationDate, IsModified, GetUserName, Value, SetUserName, SetValue, GetCreationDate
248 /** \example example23
251 /** \example example8
252 AttributeDrawable interface(creations/saving/restoring)\n
253 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
254 Attribute methods : SetDrawable, IsDrawable
256 /** \example example9
257 AttributeSelectable interface(creations/saving/restoring)\n
258 SALOMEDS methods: FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
259 Attribute methods: SetSelectable, IsSelectable
261 /** \example example10
262 AttributeExpandable interface(creations/saving/restoring)\n
263 SALOMEDS methods : SaveAs FindComponent FindAttribute Open\n
264 Attribute methods : SetExpandable IsExpandable
266 /** \example example11
267 Test AttributeOpened (creations/saving/restoring)\n
268 SALOMEDS methods : FindOrCreateAttribute SaveAs, FindComponent, FindAttribute, Open\n
269 Attribute methods : SetOpened, IsOpened
271 /** \example example12
272 AttributeTextColor interface (creations/saving/restoring)\n
273 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
274 Attribute methods : SetTextColor TextColor
276 /** \example example13
277 Test AttributeTextHighlightColor interface(creations/saving/restoring)\n
278 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
279 Attribute methods : SetTextHighlightColor TextHighlightColor
281 /** \example example14
282 AttributePixMap interface (creations/saving/restoring)\n
283 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
284 Attribute methods : SetPixMap, GetPixMap
287 /** \example example21
288 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
289 Attribute methods: GetValue, GetNbColumns, AddColumn, SetRowTitles, PutValue, GetColumn, GetColumnTitles, GetTitle, SetRow, GetRowTitles, SetColumnTitles, SetColumn, GetRow, GetNbRows, SetColumnTitle, AddRow, SetTitle, SetRowTitle
291 /** \example example15
292 AttributeLocalID interface(creations/saving/restoring)\n
293 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
294 Attribute methods : Value, SetValue
296 /** \example example22
297 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
298 Attribute methods : GetValue, GetNbColumns, AddColumn, SetRowTitles, PutValue, GetColumn, GetColumnTitles, GetTitle, SetRow, GetRowTitles, SetColumnTitles, SetColumn, GetRow, GetNbRows, SetColumnTitle, AddRow, SetTitle, SetRowTitle
300 /** \example example4
301 AttributeSequenceOfInteger interface(creations/saving/restoring)\n
302 SALOMEDS methods : FindOrCreateAttribute FindComponent FindAttribute Open Add SaveAs
303 AttributeSequenceOfInteger methods : Value, Remove, Length
305 /** \example example5
306 AttributeName interface(creations/saving/restoring)\n
307 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open\n
308 Attribute methods : SetValue, Value
310 /** \example example6
311 AttributeComment interface(creations/saving/restoring)\n
312 SALOMEDS methods : FindOrCreateAttribute, SaveAs FindComponent FindAttribute Open\n
313 Attribute methods : Value, SetValue
315 /** \example example7
316 AttributePersistentRef interface(creations/saving/restoring)\n
317 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open\n
318 Attribute methods : SetValue, Value