Salome HOME
Porting to Python 3
authorGilles DAVID <gilles-g.david@edf.fr>
Fri, 24 Mar 2017 09:24:39 +0000 (10:24 +0100)
committerGilles DAVID <gilles-g.david@edf.fr>
Fri, 24 Mar 2017 09:24:39 +0000 (10:24 +0100)
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/GUI/BLSURFPluginGUI_Dlg.h
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx

index af4e99d7f139edaf2f92aa711c5a5906fc7831c2..873213066e03d9db7ca9695d4deb5f64a51a8962 100644 (file)
@@ -86,7 +86,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   def __init__(self, mesh, geom=0):
     Mesh_Algorithm.__init__(self)
     if noBLSURFPlugin:
-      print "Warning: BLSURFPlugin module unavailable"
+      print("Warning: BLSURFPlugin module unavailable")
     if mesh.GetMesh().HasShapeToMesh():
       self.Create(mesh, geom, self.algoType, LIBRARY)
     else:
@@ -190,7 +190,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   # <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
   def SetTopology(self, way):
     if way != PreCAD and way != FromCAD:
-      print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
+      print("Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way)
       way = FromCAD
     self.Parameters().SetTopology(way)
     pass
@@ -729,8 +729,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
           for f in faces:
             ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
         else:
-          raise TypeError, \
-            "Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face)
+          raise TypeError("Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face))
         pass
       hpl.append( ids )
       pass
@@ -749,7 +748,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMinSize.
     """
-    print "Warning: SetPhyMin is obsolete. Please use SetMinSize"
+    print("Warning: SetPhyMin is obsolete. Please use SetMinSize")
     self.SetMinSize(theVal)
     pass
 
@@ -758,7 +757,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMaxSize.
     """
-    print "Warning: SetPhyMax is obsolete. Please use SetMaxSize"
+    print("Warning: SetPhyMax is obsolete. Please use SetMaxSize")
     self.SetMaxSize(theVal)
     pass
 
@@ -767,7 +766,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetAngleMesh.
     """
-    print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh"
+    print("Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh")
     self.SetAngleMesh(theVal)
     pass
 
@@ -776,7 +775,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetAngleMesh.
     """
-    print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh"
+    print("Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh")
     self.SetAngleMesh(theVal)
     pass
 
@@ -785,7 +784,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMinSize.
     """
-    print "Warning: SetGeoMin is obsolete. Please use SetMinSize"
+    print("Warning: SetGeoMin is obsolete. Please use SetMinSize")
     self.SetMinSize(theVal)
     pass
 
@@ -794,7 +793,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     """
     Obsolete function. Use SetMaxSize.
     """
-    print "Warning: SetGeoMax is obsolete. Please use SetMaxSize"
+    print("Warning: SetGeoMax is obsolete. Please use SetMaxSize")
     self.SetMaxSize(theVal)
     pass
 
index 28b17917ca8329afdce9389f7f00f7a7c27c786e..388c24658d63da26ab6debf4dbc208d32fa5ba7b 100644 (file)
@@ -146,8 +146,7 @@ namespace
   static PyTypeObject PyStdOut_Type = {
     /* The ob_type field must be initialized in the module init function
      * to be portable to Windows without using C++. */
-    PyObject_HEAD_INIT(NULL)
-    0,                            /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "PyOut",                      /*tp_name*/
     sizeof(PyStdOut),             /*tp_basicsize*/
     0,                            /*tp_itemsize*/
index 7c244265c14e84e25370bf2e74fbf17697f13a65..677035e439904ed60a0f535682c8c36e9e3be2b8 100644 (file)
@@ -56,8 +56,9 @@ enum {
 // BLSURFPluginGUI_StdWidget
 //////////////////////////////////////////
 
-#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
+// WARNING: include order is important, do not swap !
 #include "BLSURFPluginGUI_HypothesisCreator.h"
+#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
 
 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_StdWidget : public QWidget, 
                                             public Ui::BLSURFPluginGUI_StdWidget_QTD
index 94ba8e72e4b64316a58756f2d7c43f6726156ab9..e4138387510f190e02142ba37c25075835c4a4fc 100644 (file)
@@ -225,8 +225,7 @@ namespace {
   static PyTypeObject PyStdOut_Type = {
     /* The ob_type field must be initialized in the module init function
      * to be portable to Windows without using C++. */
-    PyObject_HEAD_INIT(NULL)
-    0,                            /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "PyOut",                      /*tp_name*/
     sizeof(PyStdOut),             /*tp_basicsize*/
     0,                            /*tp_itemsize*/