From 0f858f99b7348b0cd764428ab783d33d60d86f6a Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 31 Jan 2016 02:28:24 +0100 Subject: [PATCH] + issue #0002417: console autocomplete runs python properties --- src/Gui/CallTips.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 066c09433e27..355d5de7325b 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -246,7 +246,14 @@ QMap CallTipsList::extractTips(const QString& context) const else if (PyObject_IsSubclass(type.ptr(), typeobj.o) == 1) { obj = type; } - + else if (PyInstance_Check(obj.ptr())) { + // instances of old style classes + PyInstanceObject* inst = reinterpret_cast(obj.ptr()); + PyObject* classobj = reinterpret_cast(inst->in_class); + obj = Py::Object(classobj); + } + // TODO: How to find new style classes + // If we have an instance of PyObjectBase then determine whether it's valid or not if (PyObject_IsInstance(inst.ptr(), typeobj.o) == 1) { Base::PyObjectBase* baseobj = static_cast(inst.ptr()); @@ -257,7 +264,7 @@ QMap CallTipsList::extractTips(const QString& context) const PyErr_Clear(); } - Py::List list(PyObject_Dir(obj.ptr()), true); + Py::List list(obj.dir()); // If we derive from PropertyContainerPy we can search for the properties in the // C++ twin class.