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.
41 \subsection subsection12 Container and component instanciation
43 See SALOME_LifeCycleCORBA for the C++ interface (Python interface obtained with SWIG
46 In the following example, a test component provided in KERNEL is launched
47 in the local container, "FactoryServer", created when %SALOME starts:
54 lcc = LifeCycleCORBA.LifeCycleCORBA()
55 obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
58 comp=obj._narrow(Engines.TestComponent)
63 The answer is something like:
66 'TestComponent_i : L = 1'
69 The _narrow() instruction is not always mandatory in Python, but sometimes
70 useful to be sure you have got the right type of %object. Here, Testcomponent
71 interface is defined in CORBA module Engines. With this example, it works also
72 without the _narrow() instruction:
78 In the next example, a component instance is created in a specific Container
79 defined by it's computer hostname and it's name. Here we use the local
80 computer. Note that in Utils_Identity, Utils_Identity::getShortHostName() gives the short
81 hostname of the computer, without domain suffixes, which is used in %SALOME.
82 The container process is created here if it does not exists, and a new
83 component instance is created:
89 lcc = LifeCycleCORBA.LifeCycleCORBA()
92 host = Utils_Identity.getShortHostName()
96 params['hostname']=host
97 params['container_name']='myContainer'
98 comp=lcc.LoadComponent(params,'SalomeTestComponent')
102 If you want to get a list of containers and component instances, client %object
103 from orbmodule provides a list:
107 clt=orbmodule.client()
115 ContainerManager.object
118 FactoryServerPy.object
119 SuperVisionContainer.object
122 SalomeTestComponent_inst_1.object
125 SalomeTestComponent_inst_1.object
126 SalomeTestComponent_inst_2.object
136 myStudyManager.object
137 SalomeAppEngine.object
140 \subsection subsection13 File transfer service
142 See SALOME_FileTransferCORBA for the C++ interface (Python interface obtained with
143 SWIG is very similar).
145 The following example shows how to tranfer a file from a remote host to the
146 client computer. Remote hostname is 'cli76cc', we would like to copy
147 'tkcvs_8_0_3.tar.gz' from remote to local computer. %A full pathname is
148 required. %A container is created on remote computer if it does not exist,
149 to handle the file transfer:
155 import LifeCycleCORBA
156 remotefile="/home/prascle/tkcvs_8_0_3.tar.gz"
157 aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile)
158 localFile=aFileTransfer.getLocalFile()
161 \subsection subsection14 CORBA Naming service access
163 See SALOME_NamingService for the C++ interface. The Python interface
164 SALOME_NamingServicePy::SALOME_NamingServicePy_i is not yet derived from the C++ interface and offers
165 only the most useful functions.
167 \subsection subsection5 Batch services
169 See <a href="Batch.html/index.html"> Batch documentation </a> (in french only).
171 \section S2_kernel_ser All IDL Interfaces
173 -# <b>Containers and component life cycle, File transfer service</b>
174 - Engines : engines CORBA module.
175 - Engines::Component : generic component interface. All %SALOME components inherit this interface.
176 - Engines::Container : host for C++ and Python components components instances
177 - Engines::fileTransfer : agent for file transfer created by a container copy a local file to a distent client
178 - Engines::fileRef : reference to a file, used by a container for file transfers
179 - Engines::ContainerManager : unique instance, in charge of container creation on remote computers
180 - Engines::MPIContainer : a parallel implementation for containers and components
183 -# <b>Study management</b>
184 - SALOMEDS : SALOMEDS CORBA module
185 - SALOMEDS.idl : \copybrief SALOMEDS.idl
186 - SALOMEDS_Attributes.idl : \copybrief SALOMEDS_Attributes.idl
188 -# <b>High speed transfer, object life cycle, exceptions, GUI interface...</b>
189 - SALOME : \copybrief SALOME
190 - SALOME_Comm.idl : \copybrief SALOME_Comm.idl
191 - SALOME_GenericObj.idl : \copybrief SALOME_GenericObj.idl
192 - SALOME_Exception.idl : \copybrief SALOME_Exception.idl
193 - SALOME_Session.idl : \copybrief SALOME_Session.idl
195 -# <b>Miscelleanous</b>
196 - SALOME_ModuleCatalog : \copybrief SALOME_ModuleCatalog
197 - SALOME_RessourcesCatalog : \copybrief SALOME_RessourcesCatalog
198 - Registry : \copybrief Registry
199 - SALOME_Logger : \copybrief SALOME_Logger
201 -# <b>Other idl for test purposes</b>
202 - NSTEST : for naming service test
203 - SALOME_TestComponent.idl : for Component test
204 - SALOME_TestModuleCatalog : for SALOME_ModuleCatalog test
205 - SALOME_TestMPIComponent.idl : \copybrief SALOME_TestMPIComponent.idl
206 - TestNotif.idl : \copybrief TestNotif.idl
208 -# <b>Some useful command scripts </b>
209 - waitNS.py : \copybrief waitNS.py
210 - waitContainers.py : \copybrief waitContainers.py
211 - showNS.py : \copybrief showNS.py
212 - shutdownSalome.py : \copybrief shutdownSalome.py
213 - killSalome.py : \copybrief killSalome.py
214 - killSalomeWithPort.py : \copybrief killSalomeWithPort.py
215 - appli_gen.py : \copybrief appli_gen.py
220 /** \example example1
221 AttributeReal interface (creations/saving/restoring)
223 Methods : FindOrCreateAttribute, Value, SaveAs, SetValue, FindComponent, FindAttribute, Open
225 /** \example example3
226 AttributeSequenceOfReal interface(creations/saving/restoring)\n
227 AttributeSequenceOfReal : ChangeValue, Add, Value, Remove, Length\n
228 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open
230 /** \example example16
231 Methods : GetAvailableUndos, ChangeValue, FindOrCreateAttribute, SaveAs, GetAvailableRedos, Undo, FindComponent, Redo, FindAttribute, Open, CommitCommand, NewCommand
233 /** \example example17
234 SALOMEDS methods : RemoveAttribute, FindOrCreateAttribute, NewStudy, GetAllAttributes, NewCommand, CommitCommand, AbortCommand, NewComponent
236 /** \example example18
237 AttributeTreeNode interface(creations/saving/restoring)\n
238 SALOMEDS methods : FindOrCreateAttribute, NewObject\n
239 Attribute methods : HasFirst, HasFather, SetPrevious, Next, InsertAfter, GetFather, HasNext, SetValue, Append, NewStudy, Label, IsRoot, Prepend, SetFather, Depth, HasPrevious
241 /** \example example19
242 SALOMEDS methods : FindOrCreateAttribute, Save, SaveAs, Close, Open, FindComponent, FindAttribute, FindObject, LoadWith
244 Attribute methods : Value, SetValue
246 /** \example example20
247 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, NewCommand, GetProperties, Open, CommitCommand, NewBuilder\n
248 Attribute methods : SetLocked, IsLocked, GetCreationMode, SetCreationDate, IsModified, GetUserName, Value, SetUserName, SetValue, GetCreationDate
250 /** \example example23
253 /** \example example8
254 AttributeDrawable interface(creations/saving/restoring)\n
255 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
256 Attribute methods : SetDrawable, IsDrawable
258 /** \example example9
259 AttributeSelectable interface(creations/saving/restoring)\n
260 SALOMEDS methods: FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
261 Attribute methods: SetSelectable, IsSelectable
263 /** \example example10
264 AttributeExpandable interface(creations/saving/restoring)\n
265 SALOMEDS methods : SaveAs FindComponent FindAttribute Open\n
266 Attribute methods : SetExpandable IsExpandable
268 /** \example example11
269 Test AttributeOpened (creations/saving/restoring)\n
270 SALOMEDS methods : FindOrCreateAttribute SaveAs, FindComponent, FindAttribute, Open\n
271 Attribute methods : SetOpened, IsOpened
273 /** \example example12
274 AttributeTextColor interface (creations/saving/restoring)\n
275 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
276 Attribute methods : SetTextColor TextColor
278 /** \example example13
279 Test AttributeTextHighlightColor interface(creations/saving/restoring)\n
280 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
281 Attribute methods : SetTextHighlightColor TextHighlightColor
283 /** \example example14
284 AttributePixMap interface (creations/saving/restoring)\n
285 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
286 Attribute methods : SetPixMap, GetPixMap
289 /** \example example21
290 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
291 Attribute methods: GetValue, GetNbColumns, AddColumn, SetRowTitles, PutValue, GetColumn, GetColumnTitles, GetTitle, SetRow, GetRowTitles, SetColumnTitles, SetColumn, GetRow, GetNbRows, SetColumnTitle, AddRow, SetTitle, SetRowTitle
293 /** \example example15
294 AttributeLocalID interface(creations/saving/restoring)\n
295 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
296 Attribute methods : Value, SetValue
298 /** \example example22
299 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open\n
300 Attribute methods : GetValue, GetNbColumns, AddColumn, SetRowTitles, PutValue, GetColumn, GetColumnTitles, GetTitle, SetRow, GetRowTitles, SetColumnTitles, SetColumn, GetRow, GetNbRows, SetColumnTitle, AddRow, SetTitle, SetRowTitle
302 /** \example example4
303 AttributeSequenceOfInteger interface(creations/saving/restoring)\n
304 SALOMEDS methods : FindOrCreateAttribute FindComponent FindAttribute Open Add SaveAs
305 AttributeSequenceOfInteger methods : Value, Remove, Length
307 /** \example example5
308 AttributeName interface(creations/saving/restoring)\n
309 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open\n
310 Attribute methods : SetValue, Value
312 /** \example example6
313 AttributeComment interface(creations/saving/restoring)\n
314 SALOMEDS methods : FindOrCreateAttribute, SaveAs FindComponent FindAttribute Open\n
315 Attribute methods : Value, SetValue
317 /** \example example7
318 AttributePersistentRef interface(creations/saving/restoring)\n
319 SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open\n
320 Attribute methods : SetValue, Value