1 # Copyright (C) 2001-2019 EDF R&D
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, or (at your option) any later version.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 # -*- coding: utf-8 -*-
21 import EFICAS_ORB__POA
23 import SALOME_ComponentPy
25 class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
27 Python implementation of generic SALOMEDS driver.
28 Should be inherited by any Python module's engine
29 to provide persistence mechanism.
31 def __init__ (self, componentDataType):
32 print ("SALOME_DriverPy.__init__: ", componentDataType)
33 self._ComponentDataType = componentDataType
35 def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII):
36 return theSObject.GetID()
38 def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII):
41 def ComponentDataType(self):
42 return self._ComponentDataType
44 def Save(self, theComponent, theURL, isMultiFile):
47 def SaveASCII(self, theComponent, theURL, isMultiFile):
48 return self.Save(theComponent, theURL, isMultiFile)
50 def Load(self, theComponent, theStream, theURL, isMultiFile):
53 def LoadASCII(self, theComponent, theStream, theURL, isMultiFile):
54 return self.Load(theComponent, theStream, theURL, isMultiFile)
56 def Close(self, theComponent):
59 def CanPublishInStudy(self, theIOR):
62 def PublishInStudy(self, theStudy, theSObject, theObject, theName):
65 def CanCopy(self, theObject):
70 class EFICAS(EFICAS_ORB__POA.EFICAS_Gen,
71 SALOME_ComponentPy.SALOME_ComponentPy_i,
74 Pour etre un composant SALOME cette classe Python
75 doit avoir le nom du composant et heriter de la
76 classe EFICAS_Gen issue de la compilation de l'idl
77 par omniidl et de la classe SALOME_ComponentPy_i
78 qui porte les services generaux d'un composant SALOME
80 def __init__ (self, orb, poa, contID, containerName, instanceName,
82 print ("EFICAS.__init__: ", containerName,' ', instanceName)
83 SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
84 contID, containerName,instanceName, interfaceName )
85 SALOME_DriverPy_i.__init__( self, 'OTHER' )
86 # On stocke dans l'attribut _naming_service, une reference sur
87 # le Naming Service CORBA
88 self._naming_service=SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)