]> SALOME platform Git repositories - samples/pycalculator.git/commitdiff
Salome HOME
Python3 porting: 1-st draft version. ngr/python3_dev
authorrnv <rnv@opencascade.com>
Wed, 24 May 2017 07:35:26 +0000 (10:35 +0300)
committerrnv <rnv@opencascade.com>
Wed, 24 May 2017 07:35:26 +0000 (10:35 +0300)
src/PYCALCULATOR/PYCALCULATOR.py
src/PYCALCULATOR/PYCALCULATOR_TEST.py

index 4ad9a149e1c7b6a52d43774aecf49490687e2f23..369fc2ae788687fefd8552d0bad7ef01aa960541 100755 (executable)
@@ -47,7 +47,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,
@@ -59,9 +59,9 @@ class PYCALCULATOR(PYCALCULATOR_ORB__POA.PYCALCULATOR_Gen, SALOME_ComponentPy.SA
             interfaceName,    # component interface name
             False)            # notification flag (for notification server)
 
-       self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)
+        self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)
 
-        if verbose(): print "End of PYCALCULATOR::__init__"
+        if verbose(): print("End of PYCALCULATOR::__init__")
 
         pass
 
@@ -75,8 +75,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 +88,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 +105,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 +124,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 +141,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 +160,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 +177,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 +194,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 +211,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 +228,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")
index e0a3a1ac14f0f54af9aba344850b46d59012f6b9..4f5d9663afcb3d54bed902e58c384caba67a631f 100755 (executable)
@@ -42,7 +42,7 @@ pc = salome.lcc.FindOrLoadComponent('FactoryServer','PYCALCULATOR')
 medFile   = os.path.join(os.getenv("DATA_DIR"), "MedFiles", "pointe.med")
 meshName  = "maa1"
 fieldName = "fieldcelldoublevector"
-print medFile, meshName, fieldName
+print(medFile, meshName, fieldName)
 
 f = ReadFieldCell(medFile, meshName, 0, fieldName, -1, -1)
 forig = MEDCouplingFieldDoubleServant._this(f)
@@ -60,9 +60,9 @@ clt_f2 = MEDCouplingFieldDoubleClient.New(f2)
 clt_f3 = MEDCouplingFieldDoubleClient.New(f3)
 clt_f4 = MEDCouplingFieldDoubleClient.New(f4)
 
-print "clt_forig:", clt_forig
-print "clt_fcopy:", clt_fcopy
-print "clt_f1:", clt_f1
-print "clt_f2:", clt_f2
-print "clt_f3:", clt_f3
-print "clt_f4:", clt_f4
+print("clt_forig:", clt_forig)
+print("clt_fcopy:", clt_fcopy)
+print("clt_f1:", clt_f1)
+print("clt_f2:", clt_f2)
+print("clt_f3:", clt_f3)
+print("clt_f4:", clt_f4)