App: expose more methods of Document class to Python
This commit is contained in:
@@ -38,6 +38,24 @@
|
||||
<UserDocu>Restore the document from disk</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isSaved">
|
||||
<Documentation>
|
||||
<UserDocu>Checks if the document is saved</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getProgramVersion">
|
||||
<Documentation>
|
||||
<UserDocu>Get the program version that a project file was created with</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getFileName">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
For a regular document it returns its file name property.
|
||||
For a temporary document it returns its transient directory.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="mergeProject">
|
||||
<Documentation>
|
||||
<UserDocu>Merges this document with another project file</UserDocu>
|
||||
@@ -144,12 +162,42 @@ object of this document.
|
||||
<UserDocu>Clear the undo stack of the document</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="clearDocument">
|
||||
<Documentation>
|
||||
<UserDocu>Clear the whole document</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setClosable">
|
||||
<Documentation>
|
||||
<UserDocu>Set a flag that allows or forbids to close a document</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isClosable">
|
||||
<Documentation>
|
||||
<UserDocu>Check if the document can be closed. The default value is True</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="recompute">
|
||||
<Documentation>
|
||||
<UserDocu>recompute(objs=None): Recompute the document and returns the amount of recomputed features</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getObject">
|
||||
<Methode Name="mustExecute">
|
||||
<Documentation>
|
||||
<UserDocu>Check if any object must be recomputed</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="purgeTouched">
|
||||
<Documentation>
|
||||
<UserDocu>Purge the touched state of all objects</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isTouched">
|
||||
<Documentation>
|
||||
<UserDocu>Check if any object is in touched state</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getObject">
|
||||
<Documentation>
|
||||
<UserDocu>Return the object with the given name</UserDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -148,6 +148,30 @@ PyObject* DocumentPy::restore(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::isSaved(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
bool ok = getDocumentPtr()->isSaved();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::getProgramVersion(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
const char* version = getDocumentPtr()->getProgramVersion();
|
||||
return Py::new_reference_to(Py::String(version));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::getFileName(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
const char* fn = getDocumentPtr()->getFileName();
|
||||
return Py::new_reference_to(Py::String(fn));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::mergeProject(PyObject * args)
|
||||
{
|
||||
char* filename;
|
||||
@@ -446,14 +470,39 @@ PyObject* DocumentPy::redo(PyObject * args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::clearUndos(PyObject * args)
|
||||
PyObject* DocumentPy::clearUndos(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
getDocumentPtr()->clearUndos();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::clearDocument(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
getDocumentPtr()->clearDocument();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::setClosable(PyObject* args)
|
||||
{
|
||||
PyObject* close;
|
||||
if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &close))
|
||||
return nullptr;
|
||||
getDocumentPtr()->setClosable(PyObject_IsTrue(close) ? true : false);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::isClosable(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
bool ok = getDocumentPtr()->isClosable();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::recompute(PyObject * args)
|
||||
{
|
||||
PyObject *pyobjs = Py_None;
|
||||
@@ -497,6 +546,30 @@ PyObject* DocumentPy::recompute(PyObject * args)
|
||||
} PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::mustExecute(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
bool ok = getDocumentPtr()->mustExecute();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::isTouched(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
bool ok = getDocumentPtr()->isTouched();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::purgeTouched(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
getDocumentPtr()->purgeTouched();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::getObject(PyObject *args)
|
||||
{
|
||||
long id = -1;
|
||||
|
||||
Reference in New Issue
Block a user