本文整理汇总了C++中ViewProvider::getPyObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewProvider::getPyObject方法的具体用法?C++ ViewProvider::getPyObject怎么用?C++ ViewProvider::getPyObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewProvider
的用法示例。
在下文中一共展示了ViewProvider::getPyObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getActiveObject
Py::Object DocumentPy::getActiveObject(void) const
{
App::DocumentObject *object = getDocumentPtr()->getDocument()->getActiveObject();
if (object) {
ViewProvider *viewObj = getDocumentPtr()->getViewProvider(object);
return Py::Object(viewObj->getPyObject(), true);
} else {
return Py::None();
}
}
示例2: getInEdit
PyObject* DocumentPy::getInEdit(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
ViewProvider* vp = getDocumentPtr()->getInEdit();
if (vp) {
return vp->getPyObject();
}
Py_Return;
}
示例3: activeObject
PyObject* DocumentPy::activeObject(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
App::DocumentObject *pcFtr = getDocumentPtr()->getDocument()->getActiveObject();
if (pcFtr) {
ViewProvider *pcView = getDocumentPtr()->getViewProvider(pcFtr);
return pcView->getPyObject();
} else {
Py_Return;
}
} PY_CATCH;
}
示例4: getObject
PyObject* DocumentPy::getObject(PyObject *args)
{
char *sName;
if (!PyArg_ParseTuple(args, "s",&sName)) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
ViewProvider *pcView = getDocumentPtr()->getViewProviderByName(sName);
if (pcView)
return pcView->getPyObject();
else {
Py_Return;
}
} PY_CATCH;
}
示例5: getDocumentPtr
PyObject *DocumentPy::getCustomAttributes(const char* attr) const
{
// Note: Here we want to return only a document object if its
// name matches 'attr'. However, it is possible to have an object
// with the same name as an attribute. If so, we return 0 as other-
// wise it wouldn't be possible to address this attribute any more.
// The object must then be addressed by the getObject() method directly.
if (this->ob_type->tp_dict == NULL) {
if (PyType_Ready(this->ob_type) < 0)
return 0;
}
PyObject* item = PyDict_GetItemString(this->ob_type->tp_dict, attr);
if (item) return 0;
// search for an object with this name
ViewProvider* obj = getDocumentPtr()->getViewProviderByName(attr);
return (obj ? obj->getPyObject() : 0);
}