Gui: Introduce Gui::Document::createView to Python.
This commit is contained in:
@@ -2456,7 +2456,7 @@ MDIView *Document::setActiveView(const ViewProviderDocumentObject* vp, Base::Typ
|
||||
/**
|
||||
* @brief Document::setActiveWindow
|
||||
* If this document is active and the view is part of it then it will be
|
||||
* activated. If the document is not active of the view is already active
|
||||
* activated. If the document is not active or if the view is already active
|
||||
* nothing is done.
|
||||
* @param view
|
||||
*/
|
||||
|
||||
@@ -119,6 +119,16 @@ The active object of the document. Deprecated, use ActiveObject.</UserDocu>
|
||||
The active view of the document. Deprecated, use ActiveView.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="createView">
|
||||
<Documentation>
|
||||
<UserDocu>createView(type) -> object or None
|
||||
|
||||
Return a newly created view of a given type.
|
||||
|
||||
type : str
|
||||
Type name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="mdiViewsOfType" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>mdiViewsOfType(type) -> list of MDIView
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user