Show dynamically added methods in calltips list
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentPy.h>
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/DocumentPy.h>
|
||||
@@ -232,8 +233,19 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
Py::Object type(PyObject_Type(obj.ptr()), true);
|
||||
Py::Object inst = obj; // the object instance
|
||||
union PyType_Object typeobj = {&Base::PyObjectBase::Type};
|
||||
bool subclass = (PyObject_IsSubclass(type.ptr(), typeobj.o) == 1);
|
||||
if (subclass) obj = type;
|
||||
union PyType_Object typedoc = {&App::DocumentObjectPy::Type};
|
||||
if (PyObject_IsSubclass(type.ptr(), typedoc.o) == 1) {
|
||||
// From the template Python object we don't query its type object because there we keep
|
||||
// a list of additional methods that we won't see otherwise. But to get the correct doc
|
||||
// strings we query the type's dict in the class itself.
|
||||
// To see if we have a template Python object we check for the existence of supportedProperties
|
||||
if (!type.hasAttr("supportedProperties")) {
|
||||
obj = type;
|
||||
}
|
||||
}
|
||||
else if (PyObject_IsSubclass(type.ptr(), typeobj.o) == 1) {
|
||||
obj = type;
|
||||
}
|
||||
|
||||
// If we have an instance of PyObjectBase then determine whether it's valid or not
|
||||
if (PyObject_IsInstance(inst.ptr(), typeobj.o) == 1) {
|
||||
|
||||
Reference in New Issue
Block a user