From 09eca18e99d3e431aa79d6d6fe20f11d1664a860 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 18 Oct 2020 14:33:53 +0200 Subject: [PATCH] Part: remove deprecated type LinePyOld --- src/Mod/Part/App/AppPart.cpp | 107 +----------------------- src/Mod/Part/App/TopoShapeEdgePyImp.cpp | 43 ++-------- 2 files changed, 7 insertions(+), 143 deletions(-) diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index ba5ae7d84d..5e86624b16 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -150,101 +150,6 @@ PyObject* Part::PartExceptionOCCRangeError; PyObject* Part::PartExceptionOCCConstructionError; PyObject* Part::PartExceptionOCCDimensionError; -// <--- -namespace Part { - -// Compatibility class to keep old code working until removed -class LinePyOld : public LineSegmentPy -{ -public: - static PyTypeObject Type; - virtual PyTypeObject *GetType(void) {return &Type;} - -public: - static PyObject *PyMake(struct _typeobject *, PyObject *, PyObject *) - { - PyErr_SetString(PyExc_DeprecationWarning, "For future usage 'Line' will be an infinite line, use 'LineSegment' instead"); - PyErr_Print(); - return new LinePyOld(new GeomLineSegment); - } - LinePyOld(GeomLineSegment *pcObject, PyTypeObject *T = &Type) - : LineSegmentPy(pcObject, T) - { - } - virtual ~LinePyOld() - { - } -}; - -/// Type structure of LinePyOld -PyTypeObject LinePyOld::Type = { - // PyObject_HEAD_INIT(&PyType_Type) - // 0, /*ob_size*/ - PyVarObject_HEAD_INIT(&PyType_Type,0) - "Part.Line", /*tp_name*/ - sizeof(LinePyOld), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - PyDestructor, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call */ - 0, /*tp_str */ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - /* --- Functions to access object as input/output buffer ---------*/ - 0, /* tp_as_buffer */ - /* --- Flags to define presence of optional/expanded features */ -#if PY_MAJOR_VERSION >= 3 - Py_TPFLAGS_DEFAULT, /*tp_flags */ -#else - Py_TPFLAGS_HAVE_CLASS, /*tp_flags */ -#endif - "", - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - 0, /*tp_iter */ - 0, /*tp_iternext */ - 0, /*tp_methods */ - 0, /*tp_members */ - 0, /*tp_getset */ - &LineSegmentPy::Type, /*tp_base */ - 0, /*tp_dict */ - 0, /*tp_descr_get */ - 0, /*tp_descr_set */ - 0, /*tp_dictoffset */ - __PyInit, /*tp_init */ - 0, /*tp_alloc */ - Part::LinePyOld::PyMake,/*tp_new */ - 0, /*tp_free Low-level free-memory routine */ - 0, /*tp_is_gc For PyObject_IS_GC */ - 0, /*tp_bases */ - 0, /*tp_mro method resolution order */ - 0, /*tp_cache */ - 0, /*tp_subclasses */ - 0, /*tp_weaklist */ - 0, /*tp_del */ - 0 /*tp_version_tag */ -#if PY_MAJOR_VERSION >=3 - ,0 /*tp_finalize */ -#endif -#if PY_VERSION_HEX >= 0x03080000 - ,0 /*tp_vectorcall */ -#endif -}; - -} -// ---> - PyMOD_INIT_FUNC(Part) { Base::Console().Log("Module: Part\n"); @@ -324,18 +229,8 @@ PyMOD_INIT_FUNC(Part) Base::Interpreter().addType(&Part::TopoShapeCompSolidPy ::Type,partModule,"CompSolid"); Base::Interpreter().addType(&Part::TopoShapeShellPy ::Type,partModule,"Shell"); - Base::Reference hPartGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - // General - Base::Reference hGenPGrp = hPartGrp->GetGroup("General"); - if (hGenPGrp->GetBool("LineOld", false)) { - Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"_Line"); - Base::Interpreter().addType(&Part::LinePyOld ::Type,partModule,"Line"); - } - else { - Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"Line"); - } + Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"Line"); Base::Interpreter().addType(&Part::LineSegmentPy ::Type,partModule,"LineSegment"); Base::Interpreter().addType(&Part::PointPy ::Type,partModule,"Point"); Base::Interpreter().addType(&Part::ConicPy ::Type,partModule,"Conic"); diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp index 782efc4fbf..a915a4a750 100644 --- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp @@ -821,43 +821,12 @@ Py::Object TopoShapeEdgePy::getCurve() const { case GeomAbs_Line: { - static bool LineOld = true; - static bool init = false; - if (!init) { - init = true; - Base::Reference hPartGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - Base::Reference hGenPGrp = hPartGrp->GetGroup("General"); - LineOld = hGenPGrp->GetBool("LineOld", false); - } - - if (LineOld) { - GeomLineSegment* line = new GeomLineSegment(); - Handle(Geom_TrimmedCurve) this_curv = Handle(Geom_TrimmedCurve)::DownCast - (line->handle()); - Handle(Geom_Line) this_line = Handle(Geom_Line)::DownCast - (this_curv->BasisCurve()); - this_line->SetLin(adapt.Line()); - this_curv->SetTrim(adapt.FirstParameter(), adapt.LastParameter()); - PyErr_SetString(PyExc_DeprecationWarning, - "For future usage 'Curve' will return 'Line' which is infinite " - "instead of the limited 'LineSegment'.\n" - "If you need a line segment then use this:\n" - "Part.LineSegment(edge.Curve,edge.FirstParameter,edge.LastParameter)\n" - "To suppress the warning set BaseApp/Preferences/Mod/Part/General/LineOld to false"); - PyErr_Print(); - - curve = new LineSegmentPy(line); // LinePyOld - break; - } - else { - GeomLine* line = new GeomLine(); - Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast - (line->handle()); - this_curv->SetLin(adapt.Line()); - curve = new LinePy(line); - break; - } + GeomLine* line = new GeomLine(); + Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast + (line->handle()); + this_curv->SetLin(adapt.Line()); + curve = new LinePy(line); + break; } case GeomAbs_Circle: {