diff --git a/src/Gui/DocumentPy.xml b/src/Gui/DocumentPy.xml index 6775d9a9a5..dfc0354719 100644 --- a/src/Gui/DocumentPy.xml +++ b/src/Gui/DocumentPy.xml @@ -97,6 +97,18 @@ Return a list of mdi views of a given type.\n type : str\n Type name. + + + save() -> bool\n +Attempts to save the document + + + + + saveAs() -> bool\n +Attempts to save the document under a new name + + sendMsgToViews(msg) -> None\n diff --git a/src/Gui/DocumentPyImp.cpp b/src/Gui/DocumentPyImp.cpp index e31e3bb0e7..0d105081ff 100644 --- a/src/Gui/DocumentPyImp.cpp +++ b/src/Gui/DocumentPyImp.cpp @@ -276,6 +276,30 @@ PyObject* DocumentPy::mdiViewsOfType(PyObject *args) PY_CATCH; } +PyObject* DocumentPy::save(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return nullptr; + + PY_TRY { + bool ok = getDocumentPtr()->save(); + return Py::new_reference_to(Py::Boolean(ok)); + } + PY_CATCH; +} + +PyObject* DocumentPy::saveAs(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return nullptr; + + PY_TRY { + bool ok = getDocumentPtr()->saveAs(); + return Py::new_reference_to(Py::Boolean(ok)); + } + PY_CATCH; +} + PyObject* DocumentPy::sendMsgToViews(PyObject *args) { char* msg;