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

@@ -47,6 +47,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/Interpreter.h>
#include <Base/PlacementPy.h>
#include <Base/PyWrapParseTupleAndKeywords.h>
#include <Base/RotationPy.h>
#include <Base/VectorPy.h>
@@ -368,11 +369,12 @@ Py::Object View3DInventorPy::fitAll(const Py::Tuple& args)
Py::Object View3DInventorPy::boxZoom(const Py::Tuple& args, const Py::Dict& kwds)
{
static char* kwds_box[] = {"XMin", "YMin", "XMax", "YMax", nullptr};
static const std::array<const char *, 5> kwds_box{"XMin", "YMin", "XMax", "YMax", nullptr};
short xmin, ymin, xmax, ymax;
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "hhhh", kwds_box,
&xmin, &ymin, &xmax, &ymax))
if (!Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "hhhh", kwds_box,
&xmin, &ymin, &xmax, &ymax)) {
throw Py::Exception();
}
SbBox2s box(xmin, ymin, xmax, ymax);
getView3DIventorPtr()->getViewer()->boxZoom(box);
@@ -2476,15 +2478,16 @@ Py::Object View3DInventorPy::setName(const Py::Tuple& args)
Py::Object View3DInventorPy::toggleClippingPlane(const Py::Tuple& args, const Py::Dict& kwds)
{
static char* keywords[] = {"toggle", "beforeEditing", "noManip", "pla", nullptr};
static const std::array<const char *, 5> keywords {"toggle", "beforeEditing", "noManip", "pla", nullptr};
int toggle = -1;
PyObject *beforeEditing = Py_False;
PyObject *noManip = Py_True;
PyObject *pyPla = Py_None;
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "|iO!O!O!", keywords,
if (!Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "|iO!O!O!", keywords,
&toggle, &PyBool_Type, &beforeEditing, &PyBool_Type, &noManip,
&Base::PlacementPy::Type, &pyPla))
&Base::PlacementPy::Type, &pyPla)) {
throw Py::Exception();
}
Base::Placement pla;
if(pyPla!=Py_None)