+ make float assignment more pythonic

This commit is contained in:
wmayer 2013-10-08 12:54:20 +02:00
parent 26837381ac
commit 1e860356e7
2 changed files with 6 additions and 2 deletions

View File

@ -1503,12 +1503,12 @@ Py::Int MeshPy::getCountFacets(void) const
Py::Float MeshPy::getArea(void) const
{
return Py::Float((long)getMeshObjectPtr()->getSurface());
return Py::Float(getMeshObjectPtr()->getSurface());
}
Py::Float MeshPy::getVolume(void) const
{
return Py::Float((long)getMeshObjectPtr()->getVolume());
return Py::Float(getMeshObjectPtr()->getVolume());
}
PyObject *MeshPy::getCustomAttributes(const char* attr) const

View File

@ -502,7 +502,11 @@ int @self.export.Name@::staticCallback_set@i.Name@ (PyObject *self, PyObject *va
}
try {
+ if (i.Parameter.Type == "Float"):
((@self.export.Name@*)self)->set@i.Name@(Py::@i.Parameter.Type@(PyNumber_Float(value),true));
= else:
((@self.export.Name@*)self)->set@i.Name@(Py::@i.Parameter.Type@(value,false));
-
return 0;
} catch (const Py::Exception&) {
// The exception text is already set