PyObject *
ColorAttributeList_ClearColors(PyObject *self, PyObject *args)
{
    ColorAttributeListObject *obj = (ColorAttributeListObject *)self;
    int n = obj->data->GetNumColors();
    for(int i = 0; i < n; ++i)
    {
        ColorAttributeList_Remove_One_Colors(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}
示例#2
0
PyObject *
ColorAttributeList_RemoveColors(PyObject *self, PyObject *args)
{
    int index;
    if(!PyArg_ParseTuple(args, "i", &index))
        return NULL;
    ColorAttributeListObject *obj = (ColorAttributeListObject *)self;
    if(index < 0 || index >= obj->data->GetNumColors())
    {
        PyErr_SetString(PyExc_IndexError, "Index out of range");
        return NULL;
    }

    return ColorAttributeList_Remove_One_Colors(self, index);
}
PyObject *
ColorAttributeList_RemoveColors(PyObject *self, PyObject *args)
{
    int index;
    if(!PyArg_ParseTuple(args, "i", &index))
        return NULL;
    ColorAttributeListObject *obj = (ColorAttributeListObject *)self;
    if(index < 0 || index >= obj->data->GetNumColors())
    {
        char msg[400] = {'\0'};
        SNPRINTF(msg, 400, "In ColorAttributeList::RemoveColors : Index %d is out of range", index);
        PyErr_SetString(PyExc_IndexError, msg);
        return NULL;
    }

    return ColorAttributeList_Remove_One_Colors(self, index);
}