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