From 6a9594d4c0a7d00fa946ef7571764cf5c098f325 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 15 Jun 2013 15:32:06 +0200 Subject: [PATCH] Don't show attribute 'Type' in call tips any more --- src/Base/BaseClassPy.xml | 6 ------ src/Base/BaseClassPyImp.cpp | 16 ++++++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Base/BaseClassPy.xml b/src/Base/BaseClassPy.xml index 661816822..4d2122047 100644 --- a/src/Base/BaseClassPy.xml +++ b/src/Base/BaseClassPy.xml @@ -24,12 +24,6 @@ Returns all descentences - - - Is the type of the FreeCAD object with module domain (deprecated use TypeId) - - - Is the type of the FreeCAD object with module domain diff --git a/src/Base/BaseClassPyImp.cpp b/src/Base/BaseClassPyImp.cpp index 879123c71..1ff47646c 100644 --- a/src/Base/BaseClassPyImp.cpp +++ b/src/Base/BaseClassPyImp.cpp @@ -68,13 +68,6 @@ PyObject* BaseClassPy::getAllDerivedFrom(PyObject *args) return Py::new_reference_to(res); } -Py::String BaseClassPy::getType(void) const -{ - PyErr_SetString(PyExc_DeprecationWarning, "Use 'TypeId' instead"); - PyErr_Print(); - return Py::String(std::string(getBaseClassPtr()->getTypeId().getName())); -} - Py::String BaseClassPy::getTypeId(void) const { return Py::String(std::string(getBaseClassPtr()->getTypeId().getName())); @@ -85,8 +78,15 @@ Py::Int BaseClassPy::getModule(void) const return Py::Int(); } -PyObject *BaseClassPy::getCustomAttributes(const char* /*attr*/) const +PyObject *BaseClassPy::getCustomAttributes(const char* attr) const { + // this attribute is marked 'deprecated' but to keep old code working we + // handle it here. In a future version this will be removed. + if (strcmp(attr, "Type") == 0) { + PyErr_SetString(PyExc_DeprecationWarning, "Use 'TypeId' instead"); + PyErr_Print(); + return Py::new_reference_to(Py::String(std::string(getBaseClassPtr()->getTypeId().getName()))); + } return 0; }