Export Contact::setLayer() to the Python interface.

This commit is contained in:
Jean-Paul Chaput 2023-01-14 12:05:51 +01:00
parent 3e921ff07a
commit c86d074f06
2 changed files with 24 additions and 5 deletions

View File

@ -138,6 +138,28 @@ extern "C" {
}
static PyObject* PyContact_setLayer ( PyContact* self, PyObject* args )
{
cdebug_log(30,0) << "PyContact_setLayer()" << endl;
HTRY
METHOD_HEAD("Contact.setLayer()")
PyObject* pyLayer = NULL;
if (PyArg_ParseTuple( args, "O:Contact.setLayer", &pyLayer)) {
if (IsPyDerivedLayer(pyLayer)) {
contact->setLayer( PYDERIVEDLAYER_O( pyLayer ));
} else {
PyErr_SetString ( ConstructorError, "invalid parameter type for Contact.setLayer()." );
return NULL;
}
} else {
PyErr_SetString ( ConstructorError, "Invalid number of parameters passed to Contact.setLayer()." );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
PyMethodDef PyContact_Methods[] =
{ { "create" , (PyCFunction)PyContact_create , METH_VARARGS|METH_STATIC
, "Create a new Contact." }
@ -158,6 +180,7 @@ extern "C" {
, { "setDy" , (PyCFunction)PyContact_setDy , METH_VARARGS, "Sets the contact dy value." }
, { "setWidth" , (PyCFunction)PyContact_setWidth , METH_VARARGS, "Sets the contact width." }
, { "setHeight" , (PyCFunction)PyContact_setHeight , METH_VARARGS, "Sets the contact height." }
, { "setLayer" , (PyCFunction)PyContact_setLayer , METH_VARARGS, "Sets the contact layer." }
, {NULL, NULL, 0, NULL} /* sentinel */
};

View File

@ -14,9 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef PY_CONTACT_H
#define PY_CONTACT_H
#pragma once
#include "hurricane/isobar/PyComponent.h"
#include "hurricane/Contact.h"
@ -51,5 +49,3 @@ namespace Isobar {
} // extern "C".
} // Isobar namespace.
#endif // PY_CONTACT_H