Fixed output of ViewObject attribute in console mode
This commit is contained in:
parent
c66de2f8cb
commit
e0bdc07c4d
|
@ -98,6 +98,10 @@ Py::Object DocumentObjectPy::getViewObject(void) const
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Py::Module module(PyImport_ImportModule("FreeCADGui"),true);
|
Py::Module module(PyImport_ImportModule("FreeCADGui"),true);
|
||||||
|
if (!module.hasAttr("getDocument")) {
|
||||||
|
// in v0.14+, the GUI module can be loaded in console mode (but doesn't have all its document methods)
|
||||||
|
return Py::None();
|
||||||
|
}
|
||||||
Py::Callable method(module.getAttr("getDocument"));
|
Py::Callable method(module.getAttr("getDocument"));
|
||||||
Py::Tuple arg(1);
|
Py::Tuple arg(1);
|
||||||
arg.setItem(0, Py::String(getDocumentObjectPtr()->getDocument()->getName()));
|
arg.setItem(0, Py::String(getDocumentObjectPtr()->getDocument()->getName()));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user