Gui: expose Document::save()/saveAs() to Python

This commit is contained in:
wmayer
2022-12-31 13:01:20 +01:00
parent 178eb1dd84
commit 5e408445be
2 changed files with 36 additions and 0 deletions

View File

@@ -97,6 +97,18 @@ Return a list of mdi views of a given type.\n
type : str\n Type name.</UserDocu>
</Documentation>
</Methode>
<Methode Name="save">
<Documentation>
<UserDocu>save() -> bool\n
Attempts to save the document</UserDocu>
</Documentation>
</Methode>
<Methode Name="saveAs">
<Documentation>
<UserDocu>saveAs() -> bool\n
Attempts to save the document under a new name</UserDocu>
</Documentation>
</Methode>
<Methode Name="sendMsgToViews">
<Documentation>
<UserDocu>sendMsgToViews(msg) -> None\n

View File

@@ -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;