Gui: Introduce Gui::Document::createView to Python.

This commit is contained in:
tritao
2025-01-11 22:32:35 +00:00
committed by Chris Hennes
parent 1a5f620b7a
commit 08c1275ec4
3 changed files with 34 additions and 1 deletions

View File

@@ -254,6 +254,29 @@ PyObject* DocumentPy::activeView(PyObject *args)
PY_CATCH;
}
PyObject* DocumentPy::createView(PyObject *args)
{
char* sType;
if (!PyArg_ParseTuple(args, "s", &sType))
return nullptr;
Base::Type type = Base::Type::fromName(sType);
if (type.isBad()) {
PyErr_Format(PyExc_TypeError, "'%s' is not a valid type", sType);
return nullptr;
}
PY_TRY {
Gui::MDIView* pcView = getDocumentPtr()->createView(type);
if (pcView) {
return pcView->getPyObject();
} else {
Py_Return;
}
}
PY_CATCH;
}
PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
{
char* sType;