Allow Vectors.remove_stroke method to accept VectorStroke objects besides

2008-01-09 Joao S. O. Bueno <gwidion@mpc.com.br>

        * plug-ins/pygimp/pygimp-vectors.c: Allow Vectors.remove_stroke
        method to accept VectorStroke objects besides stroke IDs. Fix
        method names in error strings.

svn path=/trunk/; revision=24583
This commit is contained in:
Joao S. O. Bueno 2008-01-10 00:39:26 +00:00 committed by João Sebastião de Oliveira Bueno Calligaris
parent 24bd2b130b
commit 95559d7693
2 changed files with 21 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2008-01-09 Joao S. O. Bueno <gwidion@mpc.com.br>
* plug-ins/pygimp/pygimp-vectors.c: Allow Vectors.remove_stroke
method to accept VectorStroke objects besides stroke IDs. Fix
method names in error strings.
2008-01-09 Michael Natterer <mitch@gimp.org>
* modules/cdisplay_colorblind.c

View File

@ -169,7 +169,7 @@ vs_flip_free(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
static char *kwlist[] = { "x1", "y1", "x2", "y2", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:rotate", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:flip_free", kwlist,
&x1, &y1, &x2, &y2))
return NULL;
@ -446,7 +446,7 @@ vbs_cubicto(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
static char *kwlist[] = { "x0", "y0", "x1", "y1", "x2", "y2", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"dddddd:conicto", kwlist,
"dddddd:cubicto", kwlist,
&x0, &y0, &x1, &y1, &x2, &y2))
return NULL;
@ -594,16 +594,24 @@ vectors_bezier_stroke_new(PyGimpVectors *vectors, int stroke)
static PyObject *
vectors_remove_stroke(PyGimpVectors *self, PyObject *args, PyObject *kwargs)
{
int stroke;
int stroke_id ;
/* PyGimpVectorsStroke *stroke; */
PyObject *stroke = NULL;
static char *kwlist[] = { "stroke", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:remove_stroke", kwlist,
&stroke))
PyArg_ParseTupleAndKeywords(args, kwargs, "O:remove_stroke", kwlist, &stroke);
if (PyInt_Check(stroke))
stroke_id = PyInt_AsLong(stroke);
else if (PyObject_IsInstance(stroke, (PyObject *) &PyGimpVectorsStroke_Type))
stroke_id = ((PyGimpVectorsStroke *) stroke)->stroke;
else {
PyErr_SetString(PyExc_TypeError, "stroke must be a gimp.VectorsBezierStroke object or an Integer");
return NULL;
}
gimp_vectors_remove_stroke(self->ID, stroke);
gimp_vectors_remove_stroke(self->ID, stroke_id);
Py_INCREF(Py_None);
return Py_None;