Gui: Wrap PyArg_ParseTupleAndKeywords

This commit is contained in:
Chris Hennes
2023-08-25 13:16:29 -05:00
parent 56d820892c
commit 86a44c9824
5 changed files with 30 additions and 19 deletions

View File

@@ -38,6 +38,7 @@
#include <Base/Interpreter.h>
#include <Base/Tools.h>
#include <Base/UnitsApi.h>
#include <Base/PyWrapParseTupleAndKeywords.h>
#include "Selection.h"
#include "SelectionObject.h"
@@ -2102,9 +2103,9 @@ PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *ar
char* subname = nullptr;
float x = 0, y = 0, z = 0;
int type = 1;
static char *kwlist[] = {"obj","subname","x","y","z","tp",nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwd, "O!|sfffi", kwlist,
&(App::DocumentObjectPy::Type),&object,&subname,&x,&y,&z,&type)) {
static const std::array<const char *, 7> kwlist{"obj", "subname", "x", "y", "z", "tp", nullptr};
if (Base::Wrapped_ParseTupleAndKeywords(args, kwd, "O!|sfffi", kwlist, &(App::DocumentObjectPy::Type), &object,
&subname, &x, &y, &z, &type)) {
auto docObjPy = static_cast<App::DocumentObjectPy*>(object);
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
if (!docObj || !docObj->getNameInDocument()) {