From: Gilles DAVID Date: Fri, 24 Mar 2017 09:24:39 +0000 (+0100) Subject: Porting to Python 3 X-Git-Tag: V9_0_0~2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=64add360e33637ede9814319b678a41d37763d08;p=plugins%2Fblsurfplugin.git Porting to Python 3 --- diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index af4e99d..8732130 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -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): #
  • PreCAD - by pre-processing with PreCAD a CAD model
  • 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 diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 28b1791..388c246 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -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*/ diff --git a/src/GUI/BLSURFPluginGUI_Dlg.h b/src/GUI/BLSURFPluginGUI_Dlg.h index 7c24426..677035e 100644 --- a/src/GUI/BLSURFPluginGUI_Dlg.h +++ b/src/GUI/BLSURFPluginGUI_Dlg.h @@ -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 diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 94ba8e7..e413838 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -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*/