Adding translate method to PyHorizontal

Bug correction in METHOD_HEAD definition of PyHorizontal
This commit is contained in:
Damien Dupuis 2010-11-16 15:24:19 +00:00
parent c4a91ec39c
commit cefe8dc6a7
1 changed files with 23 additions and 1 deletions

View File

@ -33,7 +33,7 @@ extern "C" {
# undef ACCESS_CLASS # undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._baseObject._baseObject._object # define ACCESS_OBJECT _baseObject._baseObject._baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject._baseObject) # define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject._baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD_SUB(Horizontal,horizontal,function) # define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Horizontal,horizontal,function)
// x=================================================================x // x=================================================================x
@ -59,6 +59,27 @@ extern "C" {
DBoDestroyAttribute(PyHorizontal_destroy, PyHorizontal) DBoDestroyAttribute(PyHorizontal_destroy, PyHorizontal)
// ---------------------------------------------------------------
// Attribute Method : "PyHorizontal_translate ()"
static PyObject* PyHorizontal_translate ( PyHorizontal *self, PyObject* args ) {
trace << "PyHorizontal_translate ()" << endl;
HTRY
METHOD_HEAD ( "Horizontal.translate()" )
DbU::Unit dx=0, dy=0;
if (PyArg_ParseTuple(args,"ll:Horizontal.translate", &dx, &dy)) {
horizontal->translate(dx, dy);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal.translate()" );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyHorizontal Attribute Method table. // PyHorizontal Attribute Method table.
@ -69,6 +90,7 @@ extern "C" {
, { "setY" , (PyCFunction)PyHorizontal_setY , METH_VARARGS, "Modify the segment Y position." } , { "setY" , (PyCFunction)PyHorizontal_setY , METH_VARARGS, "Modify the segment Y position." }
, { "setDxSource", (PyCFunction)PyHorizontal_setDxSource, METH_VARARGS, "Modify the segment source X offset." } , { "setDxSource", (PyCFunction)PyHorizontal_setDxSource, METH_VARARGS, "Modify the segment source X offset." }
, { "setDxTarget", (PyCFunction)PyHorizontal_setDxTarget, METH_VARARGS, "Modify the segment target X offset." } , { "setDxTarget", (PyCFunction)PyHorizontal_setDxTarget, METH_VARARGS, "Modify the segment target X offset." }
, { "translate" , (PyCFunction)PyHorizontal_translate , METH_VARARGS, "Translates the Horizontal segment of dx and dy." }
, { "destroy" , (PyCFunction)PyHorizontal_destroy , METH_NOARGS , { "destroy" , (PyCFunction)PyHorizontal_destroy , METH_NOARGS
, "destroy associated hurricane object, the python object remains." } , "destroy associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */ , {NULL, NULL, 0, NULL} /* sentinel */