Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/pyhello.git] / src / PYHELLO / PYHELLO.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 import PYHELLO_ORB__POA
23 import SALOME_ComponentPy
24 import SALOME_DriverPy
25
26 class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen,
27               SALOME_ComponentPy.SALOME_ComponentPy_i,
28               SALOME_DriverPy.SALOME_DriverPy_i):
29     """
30         Pour etre un composant SALOME cette classe Python
31         doit avoir le nom du composant et heriter de la
32         classe PYHELLO_Gen issue de la compilation de l'idl
33         par omniidl et de la classe SALOME_ComponentPy_i
34         qui porte les services generaux d'un composant SALOME
35     """
36     def __init__ ( self, orb, poa, contID, containerName, instanceName, 
37                    interfaceName ):
38         print "PYHELLO.__init__: ", containerName, ';', instanceName
39         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
40                     contID, containerName, instanceName, interfaceName, 0)
41         SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
42         # On stocke dans l'attribut _naming_service, une reference sur
43         # le Naming Service CORBA
44         self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
45
46     def makeBanner( self, name ):
47         banner = "Hello %s!" % name
48         return banner