gimp r24583 - in trunk: . plug-ins/pygimp



Author: jsbueno
Date: Thu Jan 10 00:39:26 2008
New Revision: 24583
URL: http://svn.gnome.org/viewvc/gimp?rev=24583&view=rev

Log:
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.


Modified:
   trunk/ChangeLog
   trunk/plug-ins/pygimp/pygimp-vectors.c

Modified: trunk/plug-ins/pygimp/pygimp-vectors.c
==============================================================================
--- trunk/plug-ins/pygimp/pygimp-vectors.c	(original)
+++ trunk/plug-ins/pygimp/pygimp-vectors.c	Thu Jan 10 00:39:26 2008
@@ -169,7 +169,7 @@
 
     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 @@
     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 @@
 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))
-        return NULL;
+    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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]