X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FContainer%2FSALOME_ComponentPy.py;h=98e695eb831202038b25438210592be94692a186;hb=34bdd08c1cbba32e415e32489d56f91cf89e76da;hp=e581178d2b15e846c68960a78b2d1690e7461db3;hpb=f790e0e9159968707d985595eae9fe61740912fe;p=modules%2Fkernel.git diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py old mode 100755 new mode 100644 index e581178d2..98e695eb8 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -1,6 +1,5 @@ -#! /usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -46,7 +45,7 @@ from libNOTIFICATION import * from SALOME_utilities import * -from thread import * +from _thread import * #============================================================================= @@ -54,17 +53,16 @@ _Sleeping = 0 ## define an implementation of the component interface Engines::Component # -# +# class SALOME_ComponentPy_i (Engines__POA.EngineComponent): _orb = None _poa = None _fieldsDict = [] - _studyId = -1 - + #------------------------------------------------------------------------- def __init__ (self, orb, poa, contID, containerName, - instanceName, interfaceName, notif=0): + instanceName, interfaceName, notif=False): # Notif for notification services # NOT YET IMPLEMENTED MESSAGE( "SALOME_ComponentPy_i::__init__" + " " + str (containerName) + " " + str(instanceName) + " " + str(interfaceName) ) @@ -126,7 +124,7 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): def _get_instanceName(self): MESSAGE( "SALOME_ComponentPy_i::_get_instanceName" ) return self._instanceName - + #------------------------------------------------------------------------- def _get_interfaceName(self): @@ -137,12 +135,12 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): def ping(self): MESSAGE( "SALOME_ComponentPy_i::ping() pid " + str(os.getpid()) ) - + #------------------------------------------------------------------------- def setProperties(self, dico): self._fieldsDict = dico - + #------------------------------------------------------------------------- def getProperties(self): @@ -155,13 +153,13 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): id = self._poa.servant_to_id(self) self._poa.deactivate_object(id) return - + #------------------------------------------------------------------------- def GetContainerRef(self): MESSAGE( "SALOME_ComponentPy_i::GetContainerRef" ) return self._contId._narrow(Engines.Container) - + #------------------------------------------------------------------------- def beginService(self , serviceName ): @@ -173,21 +171,21 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): self._StartUsed = self.CpuUsed_impl() self._ThreadCpuUsed = 0 self._Executed = 1 - print "beginService for ",serviceName," Component instance : ",self._instanceName + print("beginService for ",serviceName," Component instance : ",self._instanceName) MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) ) for e in self._fieldsDict: key=e.key value=any.from_any(e.value) if isinstance(value,str): os.environ[key]=value - + #------------------------------------------------------------------------- def endService(self , serviceName ): MESSAGE( "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) ) MESSAGE( "Component instance : " + str(self._instanceName) ) - print "endService for",serviceName,"Component instance :",self._instanceName,"Cpu Used:",self.CpuUsed_impl()," (s) " + print("endService for",serviceName,"Component instance :",self._instanceName,"Cpu Used:",self.CpuUsed_impl()," (s) ") #------------------------------------------------------------------------- @@ -201,7 +199,7 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): MESSAGE( "SALOME_ComponentPy_i::Names" + str(GraphName) + str(NodeName) ) self._graphName = GraphName self._nodeName = NodeName - + #------------------------------------------------------------------------- def graphName(self): @@ -226,8 +224,8 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): # return 0 #else: # MESSAGE() - return 1 - + return 1 + #------------------------------------------------------------------------- def Kill_impl(self): @@ -292,41 +290,28 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): return 0 #------------------------------------------------------------------------- - - def DumpPython(self, theStudy, isPublished, isMultiFile): + + def DumpPython(self, isPublished, isMultiFile): aBuffer = "\0" if isMultiFile : - aBuffer = "def RebuildData(theStudy): pass\n\0" - return (aBuffer, 1) - - #------------------------------------------------------------------------- - - def getStudyId(self): - return self._studyId + aBuffer = "def RebuildData(): pass\n\0" + return (aBuffer.encode(), 1) - #------------------------------------------------------------------------- + #------------------------------------------------------------------------- def hasObjectInfo(self): return 0 - #------------------------------------------------------------------------- + #------------------------------------------------------------------------- - def getObjectInfo(self, studyId, entry): + def getObjectInfo(self, entry): return "" - #------------------------------------------------------------------------- + #------------------------------------------------------------------------- def getVersion(self): return "" # empty string means "unknown" version - #------------------------------------------------------------------------- - - def importData(self, studyId, dataContainer, options): - return [] # no implementation by default - - #------------------------------------------------------------------------- - - def getModifiedData(self, studyId): - return [] # no implementation by default + #------------------------------------------------------------------------- pass # end of SALOME_ComponentPy_i