X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPYCALCULATOR%2FPYCALCULATOR.py;h=99c70d8085f3f6a7dbf5510aa205b6796715bb77;hb=fbc3a392ba0d6de195bcd094e8b5c1941ff51e1f;hp=4d1f20c4bfd80b930f9225ff7a367a839b3821fd;hpb=d00b64184efe3d6874f47ec151a56146232a2222;p=samples%2Fpycalculator.git diff --git a/src/PYCALCULATOR/PYCALCULATOR.py b/src/PYCALCULATOR/PYCALCULATOR.py old mode 100755 new mode 100644 index 4d1f20c..99c70d8 --- a/src/PYCALCULATOR/PYCALCULATOR.py +++ b/src/PYCALCULATOR/PYCALCULATOR.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -29,11 +29,12 @@ # This is necessary to ensure that different modules will have the same definition # of dynamic types and C++ RTTI will work between them # -import DLFCN, sys -sys.setdlopenflags(DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL) +import os, sys +sys.setdlopenflags(os.RTLD_NOW | os.RTLD_GLOBAL) import PYCALCULATOR_ORB__POA import SALOME_ComponentPy +import SALOME_Embedded_NamingService_ClientPy import SALOME_MED from MEDCouplingClient import * @@ -47,7 +48,7 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA def __init__(self, orb, poa, contID, containerName, instanceName, interfaceName): - if verbose(): print "Begin of PYCALCULATOR::__init__" + if verbose(): print("Begin of PYCALCULATOR::__init__") SALOME_ComponentPy.SALOME_ComponentPy_i.__init__( self, @@ -57,11 +58,16 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA containerName, # SALOME container name instanceName, # component instance name interfaceName, # component interface name - 0) # notification flag (for notification server) - - self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb) + False) # notification flag (for notification server) + + emb_ns = self._contId.get_embedded_NS_if_ssl() + import CORBA + if CORBA.is_nil(emb_ns): + self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + else: + self._naming_service = SALOME_Embedded_NamingService_ClientPy.SALOME_Embedded_NamingService_ClientPy(emb_ns) - if verbose(): print "End of PYCALCULATOR::__init__" + if verbose(): print("End of PYCALCULATOR::__init__") pass @@ -75,8 +81,8 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA self.beginService("PYCALCULATOR::Clone") if verbose(): - print "Begin of PYCALCULATOR::Clone" - print " field : ", field + print("Begin of PYCALCULATOR::Clone") + print(" field : ", field) pass frescorba = None @@ -88,12 +94,12 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA # create CORBA field frescorba = MEDCouplingFieldDoubleServant._this(f) - except Exception, e: - if verbose(): print e + except Exception as e: + if verbose(): print(e) pass if verbose(): - print "End of PYCALCULATOR::Clone" + print("End of PYCALCULATOR::Clone") pass self.endService("PYCALCULATOR::Clone") @@ -105,9 +111,9 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA self.beginService("PYCALCULATOR::Add") if verbose(): - print "Begin of PYCALCULATOR::Add" - print " field 1 : ", field1 - print " field 2 : ", field2 + print("Begin of PYCALCULATOR::Add") + print(" field 1 : ", field1) + print(" field 2 : ", field2) pass frescorba = None @@ -124,12 +130,12 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA # create CORBA field frescorba = MEDCouplingFieldDoubleServant._this(fres) - except Exception, e: - if verbose(): print e + except Exception as e: + if verbose(): print(e) pass if verbose(): - print "End of PYCALCULATOR::Add" + print("End of PYCALCULATOR::Add") pass self.endService("PYCALCULATOR::Add") @@ -141,9 +147,9 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA self.beginService("PYCALCULATOR::Mul") if verbose(): - print "Begin of PYCALCULATOR::Mul" - print " field 1 : ", field1 - print " field 2 : ", field2 + print("Begin of PYCALCULATOR::Mul") + print(" field 1 : ", field1) + print(" field 2 : ", field2) pass frescorba = None @@ -160,12 +166,12 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA # create CORBA field frescorba = MEDCouplingFieldDoubleServant._this(fres) - except Exception, e: - if verbose(): print e + except Exception as e: + if verbose(): print(e) pass if verbose(): - print "End of PYCALCULATOR::Mul" + print("End of PYCALCULATOR::Mul") pass self.endService("PYCALCULATOR::Mul") @@ -177,9 +183,9 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA self.beginService("PYCALCULATOR::AddConstant") if verbose(): - print "Begin of PYCALCULATOR::AddConstant" - print " field : ", field - print " constant : ", val + print("Begin of PYCALCULATOR::AddConstant") + print(" field : ", field) + print(" constant : ", val) pass frescorba = None @@ -194,12 +200,12 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA # create CORBA field frescorba = MEDCouplingFieldDoubleServant._this(fres) - except Exception, e: - if verbose(): print e + except Exception as e: + if verbose(): print(e) pass if verbose(): - print "End of PYCALCULATOR::AddConstant" + print("End of PYCALCULATOR::AddConstant") pass self.endService("PYCALCULATOR::AddConstant") @@ -211,9 +217,9 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA self.beginService("PYCALCULATOR::MulConstant") if verbose(): - print "Begin of PYCALCULATOR::MulConstant" - print " field : ", field - print " constant : ", val + print("Begin of PYCALCULATOR::MulConstant") + print(" field : ", field) + print(" constant : ", val) pass frescorba = None @@ -228,12 +234,12 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA # create CORBA field frescorba = MEDCouplingFieldDoubleServant._this(fres) - except Exception, e: - if verbose(): print e + except Exception as e: + if verbose(): print(e) pass if verbose(): - print "End of PYCALCULATOR::MulConstant" + print("End of PYCALCULATOR::MulConstant") pass self.endService("PYCALCULATOR::MulConstant")