1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 ## @package dsccalcium
22 # \brief Module that provides the base class for DSC components implemented in python
26 import SALOME_ComponentPy
27 import SALOME_DriverPy
30 ## The SALOME base class for all DSC components implemented in python (interface Engines::Superv_Component).
33 class PyDSCComponent(SALOME_ComponentPy.SALOME_ComponentPy_i,
34 SALOME_DriverPy.SALOME_DriverPy_i):
36 A Python DSC component is implemented by a Python class that has
37 the name of the component and is located in a python module that has the
38 name of the component.
40 You must derive it and implement init_service and those methods
41 that are services of the component.
43 def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
44 SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
45 contID, containerName, instanceName, interfaceName, False)
46 SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
47 # create the DSC proxy
48 self.proxy=calcium.PySupervCompo(orb,poa,contID,instanceName,interfaceName )
50 def init_service(self,service):
53 enums={Engines.DSC.RemovingConnection:calcium.DSC.RemovingConnection,
54 Engines.DSC.AddingConnection:calcium.DSC.AddingConnection,
55 Engines.DSC.ApplicationError:calcium.DSC.ApplicationError,
57 def get_provides_port(self,name,error):
58 return self.proxy.get_provides_port(name,error)
60 def connect_uses_port(self,name,port):
61 self.proxy.connect_uses_port(name,port)
63 def connect_provides_port(self,name):
64 self.proxy.connect_provides_port(name)
66 def disconnect_provides_port(self,name,message):
67 self.proxy.disconnect_provides_port(name,message._v)
68 #self.proxy.disconnect_provides_port(name,self.enums[message])
70 def disconnect_uses_port(self,name,port,message):
71 self.proxy.disconnect_uses_port(name,port,message._v)
72 #self.proxy.disconnect_uses_port(name,port,self.enums[message])
74 def get_port_properties(self,name):
75 return self.proxy.get_port_properties(name)
77 def setInputFileToService(self,service_name,Salome_file_name):
78 return self.proxy.setInputFileToService(service_name,Salome_file_name)
80 def checkInputFilesToService(self,service_name):
81 return self.proxy.checkInputFilesToService(service_name)
83 def getInputFileToService(self,service_name,Salome_file_name):
84 return self.proxy.getInputFileToService(service_name,Salome_file_name)
86 def setOutputFileToService(self,service_name,Salome_file_name):
87 return self.proxy.setOutputFileToService(service_name,Salome_file_name)
89 def getOutputFileToService(self,service_name,Salome_file_name):
90 return self.proxy.getOutputFileToService(service_name,Salome_file_name)
92 def checkOutputFilesToService(self,service_name):
93 return self.proxy.checkOutputFilesToService(service_name)
95 def beginService(self,service_name):
96 SALOME_ComponentPy.SALOME_ComponentPy_i.beginService(self,service_name)
97 self.proxy.setTimeOut()